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
"""Usage: start `nc -l 127.0.0.1 8080`, then run this script.""" | |
from __future__ import print_function | |
import socket | |
import time | |
if __name__ == '__main__': | |
n1 = time.clock() | |
n2 = time.time() |
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
# pip-tools example | |
requests~=2.10 | |
# Pipfile example | |
[packages] | |
requests = '~=2.10' |
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
# luigi 1.x is renamed to luigi1 | |
from luigi1 import Task as Task1 | |
# luigi 2.x is imported as usual | |
from luigi import Task |
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
# compiled requirements.txt, or Pipfile.lock (aka "lock file") | |
certifi==2018.8.24 # via requests | |
chardet==3.0.4 # via requests | |
click==6.7 # via flask | |
flask==1.0.2 | |
idna==2.7 # via requests | |
itsdangerous==0.24 # via flask | |
jinja2==2.10 # via flask | |
markupsafe==1.0 # via jinja2 | |
requests==2.19.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
function conversion(){ | |
var tracker = _gat._createTracker('UA-XXXXXXX-X'); | |
tracker._trackEvent('Users', 'Sign Up'); | |
} | |
$('.LR-sign-up-submit').click(conversion); | |
$('.LR-sign-up-input').keypress(function(c) { | |
(13 == c.which) && conversion(); | |
}); |
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
pub fn search_bouncy() -> i32 { | |
//! procedural implementation | |
let mut n = 100; | |
let mut hit = 0.0; | |
let mut total = 100.0; | |
while hit / total < 0.99 { | |
n = n + 1; | |
if is_bouncy(n) { | |
hit = hit + 1.0; | |
} |
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/bash | |
# Usage: ./resize.sh [container ID]+ | |
set -o errexit | |
set -o nounset | |
set -o pipefail | |
sudo apt-get -qqy install jq socat | |
while [[ -n ${1:-''} ]]; do |
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
public class Main { | |
// which method does it invoke? | |
public static void main(String[] args) { | |
Object o = "this is a string"; | |
asLong(o); | |
} | |
public static void asLong(String s) { | |
System.out.println("string"); |
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/bash | |
# cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr --build . | |
# make | |
# make install DESTDIR=~/tmpinstalldir | |
fpm -f \ | |
-s dir \ | |
-t deb \ | |
-n libgit2 \ | |
-v 0.23.4ppa1 \ | |
-C ~/tmpinstalldir \ |
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
require 'mongoid' | |
require 'fabrication' | |
Mongoid::Config.load_configuration({ | |
sessions: { | |
default: { | |
hosts: ['localhost:27017'], | |
database: 'local' | |
} | |
} |