-- For the latest version: -- https://github.com/vitorgalvao/custom-alfred-iterm-scripts
-- Set this property to true to always open in a new window property open_in_new_window : false
-- Set this property to false to reuse current tab property open_in_new_tab : true
-- Handlers on new_window() tell application "iTerm" to create window with default profile end new_window
on new_tab() tell application "iTerm" to tell the first window to create tab with default profile end new_tab
on call_forward() tell application "iTerm" to activate end call_forward
on is_running() application "iTerm" is running end is_running
on has_windows() if not is_running() then return false
tell application "iTerm" if windows is {} then return false if tabs of current window is {} then return false if sessions of current tab of current window is {} then return false
set session_text to contents of current session of current tab of current window if words of session_text is {} then return false end tell
true end has_windows
on send_text(custom_text) tell application "iTerm" to tell the first window to tell current session to write text custom_text end send_text
-- Main on alfred_script(query) if has_windows() then if open_in_new_window then new_window() else if open_in_new_tab then new_tab() else -- Reuse current tab end if else -- If iTerm is not running and we tell it to create a new window, we get two -- One from opening the application, and the other from the command if is_running() then new_window() else call_forward() end if end if
-- Make sure a window exists before we continue, or the write may fail repeat until has_windows() delay 0.01 end repeat
send_text(query) call_forward() end alfred_script
这也备份一下修改之前的配置,防止丢失:
1 2 3 4 5 6
on alfred_script(q) tell application "Terminal" activate do script q end tell end alfred_script
Follow the steps below to get a working jenv installation with knowledge of your java environment. Read all the code you execute carefully: a $ symbol at the beginning of a line should be omitted, since it’s meant to show you entering a command into your terminal and observing the response after the command.
1.1 Installing jenv
On OSX, the simpler way to install jEnv is using Homebrew
position-relative
1
brew install jenv
Alternatively, and on Linux, you can install it from source :
Restart your shell by closing and reopening your terminal window or running exec $SHELL -l in the current session for the changes to take effect.
To verify jenv was installed, run jenv doctor. On a macOS machine, you’ll observe the following output:
position-relative
1 2 3 4 5 6
$ jenv doctor [OK] No JAVA_HOME set [ERROR] Java binary in path is not in the jenv shims. [ERROR] Please check your path, or try using /path/to/java/home is not a valid path to java installation. PATH : /Users/user/.jenv/libexec:/Users/user/.jenv/shims:/Users/user/.jenv/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin [OK] Jenv is correctly loaded
Observe that jenv is correctly loaded but Java is not yet installed.
To make sure JAVA_HOME is set, make sure to enable the export plugin:
Untested: While this fork has improved fish shell support, it has not been tested by this maintainer. To install jenv for Fish according to the contributor’s instructions:
With macOS OpenJDK 11.0.2 installed, for example, either of these commands will add /Library/Java/JavaVirtualMachines/openjdk-11.0.2.jdk/Contents/Home as a valid JVM. Your JVM directory may vary!
Observe now that this version of Java is added to your java versions command:
position-relative
1 2 3 4 5
$ jenv versions * system (set by /Users/user/.jenv/version) 11.0 11.0.2 openjdk64-11.0.2
By default, the latest version of Java is your system Java on macOS.
We’ll now set a jenv local VERSION local Java version for the current working directory. This will create a .java-version file we can check into Git for our projects, and jenv will load it correctly when a shell is started from this directory.
position-relative
1 2 3 4
$ jenv local 11.0.2 $exec$SHELL -l $ cat .java-version 11.0.2
Yes! Observe that JAVA_HOME is set to a valid shim directory. Unlike the main repository’s documentation we helpfully installed the export plugin, and we now have the most important jenv features covered.
If you executed this commands inside your $HOME directory, you can now delete .java-version:
position-relative
1
rm .java-version
1.3 Setting a Global Java Version
Use jenv global VERSION to set a global Java version:
position-relative
1
jenv global 11.0.2
When you next open a shell or terminal window, this version of Java will be the default.
On macOS, this sets JAVA_HOME for GUI applications on macOS using jenv macos-javahome. Integrates this tutorial to create a file that does not update dynamically depending on what local or shell version of Java is set, only global.
1.4 Setting a Shell Java Version
Use jenv shell VERSION to set the Java used in this particular shell session:
position-relative
1
jenv shell 11.0.2
2 Common Workflows
These common workflows demonstrate how to use jenv to solve common problems.
2.1 Using Two JVMs on macOS
Our goal is to have both the latest version of Java and JDK 8 installed at the same time. This is helpful for developing Android applications, whose build tools are sensitive to using an exact Java version.
We’ll resume where we left off with Java 11.0.2 installed. Let’s install Java 8 now:
This will install the latest version of Java 8 to a special directory in macOS. Let’s see which directory that is:
position-relative
1 2 3
$ ls -1 /Library/Java/JavaVirtualMachines adoptopenjdk-8.jdk openjdk-11.0.2.jdk
Observe the adoptopenjdk-8.jdk directory. Your exact version may vary. We cannot retrieve this using /usr/libexec/java_home, unfortunately. We’ll add the Java home directory using jenv so that it shows up in our jenv versions command:
➜ ~ go mod Go mod provides access to operations on modules.
Note that support for modules is built into all the go commands, not just 'go mod'. For example, day-to-day adding, removing, upgrading, and downgrading of dependencies should be done using 'go get'. See 'go help modules' for an overview of module functionality.
Usage:
go mod <command> [arguments]
The commands are:
download download modules to local cache edit edit go.mod from tools or scripts graph print module requirement graph init initialize new module in current directory tidy add missing and remove unused modules vendor make vendored copy of dependencies verify verify dependencies have expected content why explain why packages or modules are needed
Use "go help mod <command>" for more information about a command.
go mod download: 下载依赖的module到本地cache
go mod edit: 编辑go.mod
go mod graph: 打印模块依赖图
go mod init: 在当前目录下初始化go.mod(就是会新建一个go.mod文件)
go mod tidy: 整理依赖关系,会添加丢失的module,删除不需要的module
go mod vender: 将依赖复制到vendor下
go mod verify: 校验依赖
go mod why: 解释为什么需要依赖
在新项目中使用
使用go mod并不要求你的项目源码放到$GOPATH下,所以你的新项目可以放到任意你喜欢的路径。在项目根目录下执行go mod init,会生成一个go.mod文件。然后你可以在其中增加你的依赖,如下:
This one is for all MySQL-DBA’s, which are working on macOS. Since the Apple OS has a rather peculiar way of starting and stopping MySQL, compared to Linux, you can run into some issues. These problems occur especially, if you have no access to the GUI.
PREPARATION
Put skip-grant-tables into the mysqld section of the my.cnf. A my.cnf can be found in /usr/local/mysql/support-files. You MUST work as root for all the following steps.
1 2 3 4 5 6 7 8
shell> sudo -s shell> vi /usr/local/mysql/support-files/my-default.cnf
You should receive one line. The second column from the left is the process id. Use this process id to stop the MySQL-Server.
1
shell>kill -15 [process id]
In this example, the command would look like this:
1
shell>kill -15 28017
macOS will restart MySQL, since the process has not stopped correctly. The configuration will be read and the changes to the parameters will become effective. Continue with logging in to the CLI.
CONCLUSION
No matter how secure your MySQL-Password is, it is a lot more important to secure access to the server it self. If your server is not secured by something that prevents access from the internet, it will only take a few minutes for someone with bad intentions to take over your database or worse, the entire server.
Run groovy GithubTopRankCrawler.groovy -l go -d <path to store the 1000 repos> to clone all repositories locally. You can use -s to do the shallow clone and decrease disk usage.
Run groovy GoBuildToolScanner.groovy <path to store the 1000 repos> to analyze these repos.
主页:http://svdfeature.apexlab.org/wiki/Main_Page 语言:C++ 一个feature-based协同过滤和排序工具,由上海交大Apex实验室开发,代码质量较高。在KDD Cup 2012中获得第一名,KDD Cup 2011中获得第三名,相关论文 发表在2012的JMLR中,这足以说明它的高大上。 SVDFeature包含一个很灵活的Matrix Factorization推荐框架,能方便的实现SVD、SVD++等方法, 是单模型推荐算法中精度最高的一种。SVDFeature代码精炼,可以用 相对较少的内存实现较大规模的单机版矩阵分解运算。另外含有Logistic regression的model,可以很方便的用来进行ensemble。
LibMF
主页:http://www.csie.ntu.edu.tw/~cjlin/libmf/ 语言:C++ 作者Chih-Jen Lin来自大名鼎鼎的台湾国立大学,他们在机器学习领域享有盛名,近年连续多届KDD Cup竞赛上均 获得优异成绩,并曾连续多年获得冠军。台湾大学的风格非常务实,业界常用的LibSVM, Liblinear等都是他们开发的,开源代码的效率和质量都非常高。 LibMF在矩阵分解的并行化方面作出了很好的贡献,针对SGD(随即梯度下降)优化方法在并行计算中存在的locking problem和memory discontinuity问题,提出了一种 矩阵分解的高效算法FPSGD(Fast Parallel SGD),根据计算节点的个数来划分评分矩阵block,并分配计算节点。系统介绍可以见这篇 论文(ACM Recsys 2013的 Best paper Award)。
LibFM
主页:http://www.libfm.org/ 语言:C++ 作者是德国Konstanz大学的Steffen Rendle,他用LibFM同时玩转KDD Cup 2012 Track1和Track2两个子竞赛单元,都取得了很好的成绩,说明LibFM是非常管用的利器。 LibFM是专门用于矩阵分解的利器,尤其是其中实现了MCMC(Markov Chain Monte Carlo)优化算法,比常见的SGD优化方法精度要高,但运算速度要慢一些。当然LibFM中还 实现了SGD、SGDA(Adaptive SGD)、ALS(Alternating Least Squares)等算法。
异常:Could not initialize class org.bytedeco.javacpp.avutil
1 2 3 4 5 6 7 8
Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class org.bytedeco.javacpp.avutil at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:274) at org.bytedeco.javacpp.Loader.load(Loader.java:385) at org.bytedeco.javacpp.Loader.load(Loader.java:353) at org.bytedeco.javacpp.avformat$AVFormatContext.<clinit>(avformat.java:2249) at org.bytedeco.javacv.FFmpegFrameGrabber.startUnsafe(FFmpegFrameGrabber.java:346) at org.bytedeco.javacv.FFmpegFrameGrabber.start(FFmpegFrameGrabber.java:340)
/** * This is an example of HTTP basic Authentication. * It will require visitor to input a user name (xfeep) and password (hello!) * otherwise it will return 401 Unauthorized or BAD USER & PASSWORD */ publicclassBasicAuthHandlerimplementsNginxJavaRingHandler{
@Override public Object[] invoke(Map<String, Object> request) { String auth = (String) ((Map)request.get(HEADERS)).get("authorization"); if (auth == null) { returnnew Object[] { 401, ArrayMap.create("www-authenticate", "Basic realm=\"Secure Area\""), "<HTML><BODY><H1>401 Unauthorized.</H1></BODY></HTML>" }; } String[] up = new String(DatatypeConverter.parseBase64Binary(auth.substring("Basic ".length())), DEFAULT_ENCODING).split(":"); if (up[0].equals("xfeep") && up[1].equals("hello!")) { return PHASE_DONE; } returnnew Object[] { 401, ArrayMap.create("www-authenticate", "Basic realm=\"Secure Area\""), "<HTML><BODY><H1>401 Unauthorized BAD USER & PASSWORD.</H1></BODY></HTML>" }; } }
S0 — Heap上的 Survivor space 0 区已使用空间的百分比 S1 — Heap上的 Survivor space 1 区已使用空间的百分比 E — Heap上的 Eden space 区已使用空间的百分比 O — Heap上的 Old space 区已使用空间的百分比 P — Perm space 区已使用空间的百分比 YGC — 从应用程序启动到采样时发生 Young GC 的次数 YGCT– 从应用程序启动到采样时 Young GC 所用的时间(单位秒) FGC — 从应用程序启动到采样时发生 Full GC 的次数 FGCT– 从应用程序启动到采样时 Full GC 所用的时间(单位秒) GCT — 从应用程序启动到采样时用于垃圾回收的总时间(单位秒)