This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
------------------------------------------------------------------------- | |
USEFUL ONE-LINE SCRIPTS FOR SED (Unix stream editor) Dec. 29, 2005 | |
Compiled by Eric Pement - pemente[at]northpark[dot]edu version 5.5 | |
Latest version of this file (in English) is usually at: | |
http://sed.sourceforge.net/sed1line.txt | |
http://www.pement.org/sed/sed1line.txt | |
This file will also available in other languages: | |
Chinese - http://sed.sourceforge.net/sed1line_zh-CN.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
gh api gists | jq -r '.[] | select(.public == true) | .files[].raw_url' | while read -r row ; do | |
curl -sO "$row" | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
s = 'https://twitter.com/#!/twitter/status/70943739882913792' | |
print re.search('/status/(\d+)', s).group(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let promiseA = new Promise((resolve) => { | |
const timeout = 100 + Math.floor(Math.random() * 1900) | |
setTimeout(() => resolve('A'), timeout); | |
console.log('A timeout', timeout) | |
}) | |
let promiseB = new Promise((resolve) => { | |
const timeout = 100 + Math.floor(Math.random() * 1900) | |
setTimeout(() => resolve('B'), timeout); | |
console.log('B timeout', timeout) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var stdev = function(arr) { | |
var n = arr.length; | |
var sum = 0; | |
arr.map(function(data) { | |
sum+=data; | |
}); | |
var mean = sum / n; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "log" | |
func main() { | |
result := combineAndKeepOrder([]string{"a", "b", "c"}, []string{"c", "a", "d"}) | |
log.Println(result, testEq(result, []string{"c", "b", "a", "d"})) | |
result = combineAndKeepOrder([]string{}, []string{"c", "a", "d"}) | |
log.Println(result, testEq(result, []string{"c", "a", "d"})) |
# add
sudo ifconfig lo0 alias 127.0.0.2
# revert
sudo ifconfig lo0 -alias 127.0.0.2
# whoami
aws sts get-caller-identity