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 queue | |
import threading | |
num_worker_threads = 1 | |
def do_work(item): | |
print(item) | |
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
cd ~/projects/bin/dynamodb | |
cat > log4j2.xml <<- XML | |
<?xml version="1.0" encoding="UTF-8"?> | |
<Configuration status="fatal"> | |
<Appenders> | |
<Console name="STDOUT" target="SYSTEM_OUT"> | |
<PatternLayout pattern="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/> | |
</Console> | |
</Appenders> |
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
#!bash.exe | |
export SSH_AUTH_SOCK=/tmp/.ssh-socket | |
echo ; | |
echo Starting connection with ssh-agent... | |
ssh-add -l 2>&1 >/dev/null | |
if [ $? = 2 ]; then | |
rm -f /tmp/.ssh-script /tmp/.ssh-agent-pid /tmp/.ssh-socket | |
# Exit status 2 means couldn't connect to ssh-agent; start one now | |
echo Creating new ssh-agent... | |
ssh-agent -a $SSH_AUTH_SOCK > /tmp/.ssh-script |
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
>>> e = codecs.lookup('zlib').incrementalencoder() | |
>>> e.encode('foo') | |
'x\x9c' | |
>>> e.encode('bar') | |
'' | |
>>> e.encode('baz') | |
'' | |
>>> e.encode('', final=True) | |
'K\xcb\xcfOJ,JJ\xac\x02\x00\x12{\x03\xb7' |
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
// ==UserScript== | |
// @match http://*.quora.com/* | |
// ==/UserScript== | |
// a function that loads jQuery and calls a callback function when jQuery has finished loading | |
function addJQuery(callback) { | |
var script = document.createElement("script"); | |
script.setAttribute("src", "//code.jquery.com/jquery-latest.min.js"); | |
script.addEventListener('load', function() { | |
var script = document.createElement("script"); |
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
# Edits to /etc/sysctl.conf | |
kern.sysv.shmall=65536 | |
kern.sysv.shmmax=16777216 |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Ember.js Router Example</title> | |
<meta name="description" content="Example of a basic Ember.js application with a Router" /> | |
<meta name="author" content="http://codebrief.com" /> | |
<!--[if lt IE 9]> | |
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> |
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
'''read a csv file representing a table and write a restructured text simple | |
table''' | |
import sys | |
import csv | |
def get_out(out=None): | |
''' | |
return a file like object from different kinds of values | |
None: returns stdout | |
string: returns open(path) |
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 | |
from django.utils.text import compress_string | |
from django.utils.cache import patch_vary_headers | |
from django import http | |
try: | |
import settings | |
XS_SHARING_ALLOWED_ORIGINS = settings.XS_SHARING_ALLOWED_ORIGINS |