Skip to content

Instantly share code, notes, and snippets.

View yankchina's full-sized avatar
💭
Researching and Learning

yankchina yankchina

💭
Researching and Learning
View GitHub Profile
@micktwomey
micktwomey / client.py
Created October 1, 2010 13:03
python multiprocessing socket server example
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()
@dsanson
dsanson / any2pandoc.sh
Created August 30, 2011 17:52
any2pandoc.sh: script that tries to convert documents thrown at it to pandoc's extended markdown
#!/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:
@julionc
julionc / slideshare-dl.py
Created September 17, 2011 16:11
slideshare-dl is a small command-line program for downloading slides from SlideShare.net
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
slideshare-dl.py
~~~~~~~~~~~~~~~~
slideshare-dl is a small command-line program
for downloading slides from SlideShare.net
@schmurfy
schmurfy / gist:3199254
Created July 29, 2012 14:33
Install pandoc Mac OS X 10.8
# 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
@nhoizey
nhoizey / screenshots.js
Created November 12, 2012 17:07
Take screenshots at different viewport sizes using CasperJS
/*
* 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();
@appastair
appastair / youtube-dl.sh
Created November 23, 2012 10:00
YouTube Batch Video Downloader Script
#!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
@choro3
choro3 / mail_notify.py
Created January 14, 2013 06:35
メール送信スクリプト
#!/usr/bin/env python
# coding: utf-8
import sys
import argparse
import smtplib
import email
import os
import os.path
#!/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/
@qpleple
qpleple / torndb-examples.py
Last active January 8, 2019 05:10
Examples with torndb
# 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
@petrblahos
petrblahos / gist:5050586
Created February 27, 2013 18:59
Small example of bottle.py usage.
import json
import bottle
@bottle.get("/text")
def text():
return "Returning text"
@bottle.get("/data/get")
def get_data():