This file contains hidden or 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
#!/usr/bin/env bash | |
ansible-playbook -i inventory playbooks/test_single.yml --limit '!*apattern*:!special:*anotherpattern' --list-hosts |
This file contains hidden or 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
from math import exp | |
def theta(k): | |
return 1.0/(1 + exp(-k)) | |
def ht(wx, xt, uh, ht_m1, bh): return theta(wx * xt + uh * ht_m1 + bh) |
This file contains hidden or 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
val numKey = (num: Int) => (0 to 500 by 50).toStream.dropWhile(_ < num).headOption.getOrElse(600) |
This file contains hidden or 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
Set-PSReadlineOption -EditMode Emacs | |
sal -Name ls -Value C:\cygwin64\bin\ls.exe -Option AllScope | |
Set-PSReadLineOption -TokenKind Parameter -ForegroundColor Gray -BackgroundColor 0 | |
Set-Alias find "C:\cygwin64\bin\find.exe" | |
[Environment]::SetEnvironmentVariable("SSH_AUTH_SOCK", '/tmp/.ssh-pageant-sh.otsuka', "Process") | |
$agentPid=ssh-pageant -r -a '/tmp/.ssh-pageant-sh.otsuka' | grep "PID" | |
if( -not $?) { | |
$agentPid=$agentPid -replace '[A-Z,_,=,a-z,;]','' | |
[Environment]::SetEnvironmentVariable("SSH_PAGEANT_PID", $agentPid, "Process") | |
} |
This file contains hidden or 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 org.scalameter._ | |
import common._ | |
import scala.math.pow | |
val standardConfig = config( | |
Key.exec.minWarmupRuns -> 40, | |
Key.exec.maxWarmupRuns -> 80, | |
Key.exec.benchRuns -> 100, | |
Key.verbose -> false | |
) withWarmer(new Warmer.Default) |
This file contains hidden or 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 $ivy.`org.scalikejdbc::scalikejdbc:2.4.2`, scalikejdbc.ConnectionPool, scalikejdbc._ | |
import $ivy.`mysql::mysql-connector-java:5.1.32` | |
Class.forName("com.mysql.jdbc.Driver").newInstance() | |
val (url, | |
user, | |
password, | |
driver) = ("jdbc:mysql://172.17.0.2:3306/test_database", | |
"root", | |
"foo", | |
"com.mysql.jdbc.Driver") |
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
from functools import reduce | |
from sys import argv | |
def partial_fact(tries, success): | |
m = range(tries - success + 1, tries + 1) | |
return reduce((lambda x,y: x*y), m) | |
def fact(n): | |
return reduce((lambda x,y: x*y), range(1, n+1)) |
This file contains hidden or 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
" Inspired by https://github.com/chaosong | |
vmap <f6> :FormatJson <cr> | |
command -range FormatJson :call FormatJson() | |
function! FormatJson() range | |
let [lnum1, col1] = getpos("'<")[1:2] | |
let [lnum2, col2] = getpos("'>")[1:2] | |
python << EOF | |
import vim |
This file contains hidden or 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
// ==UserScript== | |
// @ShortcutManager | |
// @name open url in new window | |
// @namespace NIEQCKdtMwoR | |
// @key Ctrl+] | |
// @include * | |
// ==/UserScript== | |
javascript:window.open(window.location.href) |
This file contains hidden or 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
^1:: | |
Send, !sw | |
Return |