Skip to content

Instantly share code, notes, and snippets.

@coordt
coordt / fabfile.py
Created December 1, 2010 12:51
A Fabric fabfile that allows you to check which packages are not like the others on a set of servers.
from __future__ import with_statement
from fabric.api import env, run, settings, hide
from fabric.decorators import hosts, runs_once
venv = "/home/websites/.virtualenvs/twtv3/"
env.user = 'webdev'
env.hosts = [
'192.168.1.10',
'192.168.1.11',
@ptone
ptone / _webfaction_setup.rst
Created April 4, 2011 23:56
setting up a stack on webfaction

Setting up Webfaction for modern Django deployment

last updated: 4/5/2011

note that this stuff is always a moving target, much of this has been cribbed and combined from various blog posts. Much of the information was out of date from those, and if it is more than a couple months after the last updated date above, consider some of this likely to now be out of date.

@mihow
mihow / nginx-1.0.0-installer.py
Created April 23, 2011 01:04 — forked from robflaherty/nginx-0765-installer.txt
Nginx 1.0.0 installer for Webfaction
-----BEGIN WEBFACTION INSTALL SCRIPT-----
#!/bin/env python2.6
VERSION = "1.0.0"
"""
Nginx Installer
"autostart": not applicable
"extra info": Enter domain name for the nginx app
@mihow
mihow / _webfaction_setup.rst
Created April 26, 2011 00:21 — forked from ptone/_webfaction_setup.rst
setting up a stack on webfaction

Setting up Webfaction for modern Django deployment

last updated: 4/5/2011

note that this stuff is always a moving target, much of this has been cribbed and combined from various blog posts. Much of the information was out of date from those, and if it is more than a couple months after the last updated date above, consider some of this likely to now be out of date.

@ryanb
ryanb / README.md
Created May 15, 2011 16:24 — forked from copiousfreetime/my-gh-issues.rb
My Github Issues

First install the required gems:

gem install octokit awesomeprint rainbow

Then run it to extract all of your open GitHub issues into files (with comments).

ruby my-gh-issues.rb
@mbostock
mbostock / .block
Last active February 26, 2019 22:38
Horizon Chart
license: gpl-3.0
redirect: https://observablehq.com/@d3/d3-horizon-chart
@daveaugustine
daveaugustine / Inside_your_router.coffee
Created February 8, 2012 18:33
Super simple Google Analytics page tracking with backbone
initialize: ->
@bind 'all', @_trackPageview
_trackPageview: ->
url = Backbone.history.getFragment()
_gaq.push(['_trackPageview', "/#{url}"])
@miratcan
miratcan / fix_database_to_utf8.py
Last active August 31, 2023 00:06
Small python script that converts character sets to utf8 in all databases and tables. My solution for "Illegal mix of collations" errors. (http://stackoverflow.com/questions/3029321/how-to-solve-illegal-mix-of-collations-in-mysql)
from MySQLdb import connect
conn = connect(user="[USER]", passwd= "[PASSWORD]")
cur = conn.cursor()
cur.execute("show databases;")
dbs_to_update = filter(
lambda db: db not in ('information_schema', 'mysql', 'performance_schema'),
[dbname[0] for dbname in cur.fetchall()])
@yong27
yong27 / apply_df_by_multiprocessing.py
Last active April 12, 2023 04:35
pandas DataFrame apply multiprocessing
import multiprocessing
import pandas as pd
import numpy as np
def _apply_df(args):
df, func, kwargs = args
return df.apply(func, **kwargs)
def apply_by_multiprocessing(df, func, **kwargs):
workers = kwargs.pop('workers')
@madjar
madjar / scrapper.py
Last active March 5, 2023 15:02
A example of scrapper using asyncio and aiohttp
import asyncio
import aiohttp
import bs4
import tqdm
@asyncio.coroutine
def get(*args, **kwargs):
response = yield from aiohttp.request('GET', *args, **kwargs)
return (yield from response.read_and_close(decode=True))