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 socket | |
if __name__ == "__main__": | |
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
sock.connect(("localhost", 9000)) | |
data = "some data" | |
sock.sendall(data) | |
result = sock.recv(1024) | |
print result | |
sock.close() |
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 | |
# any2pandoc.sh | |
# | |
# A shell script that tries its best to convert documents thrown at it | |
# to pandoc's extended markdown. | |
# | |
# https://gist.github.com/1181510 | |
# | |
# Depends on: |
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
# Install MacTex: http://mirror.ctan.org/systems/mac/mactex/mactex-basic.pkg | |
$ sudo chown -R `whoami` /usr/local/texlive | |
$ tlmgr update --self | |
$ tlmgr install ucs | |
$ tlmgr install etoolbox | |
# Install pandoc view homebrew |
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
/* | |
* Takes provided URL passed as argument and make screenshots of this page with several viewport sizes. | |
* These viewport sizes are arbitrary, taken from iPhone & iPad specs, modify the array as needed | |
* | |
* Usage: | |
* $ casperjs screenshots.js http://example.com | |
*/ | |
var casper = require("casper").create(); |
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 | |
# Requires: youtube-dl (apt-get install) | |
# Usage: youtube-dl.sh < video-links.lst | |
while read line | |
do | |
youtube-dl $line --max-quality -t --write-info-json | |
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
#!/usr/bin/env python | |
# coding: utf-8 | |
import sys | |
import argparse | |
import smtplib | |
import email | |
import os | |
import os.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
#!/bin/sh | |
# any2markdown.sh | |
# | |
# A shell script that converts documents to markdown | |
# | |
# https://gist.github.com/creativecoder/4990796 | |
# | |
# Depends on: | |
# pandoc: http://johnmacfarlane.net/pandoc/ |
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
# Torndb is a very thin wrapper around MySQLdb that makes it even easier to use MySQL. | |
# Because it is very light, one can just go through the one-file python source | |
# to learn how to use it. | |
# Installation: pip install torndb | |
# Official doc: http://torndb.readthedocs.org/en/latest/ | |
# Source: https://github.com/bdarnell/torndb/blob/master/torndb.py | |
from torndb import Connection |
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 json | |
import bottle | |
@bottle.get("/text") | |
def text(): | |
return "Returning text" | |
@bottle.get("/data/get") | |
def get_data(): |
OlderNewer