As configured in my dotfiles.
start new:
tmux
start new with session name:
As configured in my dotfiles.
start new:
tmux
start new with session name:
An introduction to curl using GitHub's API.
Makes a basic GET request to the specifed URI
curl https://api.github.com/users/caspyin
I frequently administer remote servers over SSH, and need to copy data to my clipboard. If the text I want to copy all fits on one screen, then I simply select it with my mouse and press CMD-C, which asks relies on m y terminal emulator (xterm2) to throw it to the clipboard.
This isn't practical for larger texts, like when I want to copy the whole contents of a file.
If I had been editing large-file.txt locally, I could easily copy its contents by using the pbcopy command:
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <plist version="1.0"> | |
| <dict> | |
| <key>KeepAlive</key> | |
| <true/> | |
| <key>Label</key> | |
| <string>autossh.lenciel</string> | |
| <key>ProgramArguments</key> | |
| <array> |
| tell application "Spotify" | |
| set theTrack to name of the current track | |
| set theArtist to artist of the current track | |
| set theAlbum to album of the current track | |
| set track_id to id of current track | |
| set AppleScript's text item delimiters to ":" | |
| set track_id to third text item of track_id | |
| set AppleScript's text item delimiters to {""} | |
| set realurl to ("spotify://track:" & track_id) | |
| set theString to theTrack & " - " & theArtist & ": " & realurl |
| # Ignore all | |
| * | |
| # Unignore all with extensions | |
| !*.* | |
| # Unignore all dirs | |
| !*/ | |
| ### Above combination will ignore all files without extension ### |
| 生成公钥文件。Terminal下面输入 | |
| ssh-keygen -t rsa | |
| 之后在Terminal的提示里按回车。直到生成id_rsa.pub文件,生成的id_rsa.pub文件在 ~/.ssh下面。Terminal下面输入 | |
| cd ~/.ssh | |
| cp id_rsa.pub authorized_keys | |
| 上面第一句的意思是进入~/.ssh文件夹,第二句是复制id_rsa.pub为authorized_keys文件。 |
| (* | |
| Export All Safari Tabs in All Open Windows to a Markdown File | |
| July 13, 2015 | |
| // SCRIPT PAGE | |
| http://hegde.me/urlsafari | |
| // ORIGINAL SCRIPT ON WHICH THIS SCRIPT IS BUILT | |
| http://veritrope.com/code/export-all-safari-tabs-to-a-text-file |
| #!/bin/bash | |
| cartella="/var/myfolder" | |
| # update the file | |
| curl -i -X PUT -H 'Authorization: token 4d013330xxxxxxxxxxxxxx' -d "{\"path\": \"mattei.csv\", \ | |
| \"message\": \"update\", \"content\": \"$(openssl base64 -A -in $cartella/mattei.csv)\", \"branch\": \"master\",\ | |
| \"sha\": $(curl -X GET https://api.github.com/repos/username/repo/contents/mattei.csv | jq .sha)}" \ | |
| https://api.github.com/repos/username/repo/contents/mattei.csv |
| # 你可以从该 URL 下载这个配置文件: http://surge.run/config-example/ios.conf | |
| # 用编辑器编辑后,再通过 iTunes, URL, AirDrop 或者 iCloud Drive 复制回 iOS 设备 | |
| # Version 2.0 | |
| [General] | |
| # 日志等级: warning, notify, info, verbose (默认值: notify) | |
| loglevel = notify | |
| # 跳过某个域名或者 IP 段,这些目标主机将不会由 Surge Proxy 处理。(在 macOS | |
| # 版本中,如果启用了 Set as System Proxy, 那么这些值会被写入到系统网络代理 | |
| # 设置中.) |