Skip to content

Instantly share code, notes, and snippets.

View marklit's full-sized avatar

Mark Litwintschik marklit

View GitHub Profile
@rupey
rupey / mandelbrot.sql
Last active December 7, 2020 05:38
Mandelbrot plot in postgres
WITH RECURSIVE
x(i) AS ( VALUES (0)
UNION ALL SELECT i + 1
FROM x
WHERE i < 101),
Z(Ix, Iy, Cx, Cy, X, Y, I) AS (
SELECT
Ix,
Iy,
X :: FLOAT,
@amowu
amowu / chef-solo.md
Last active August 29, 2015 14:00
How to use Chef Solo.
$ gem i chef --no-ri --no-rdoc

$ knife configure

$ gem i knife-solo --no-ri --no-rdoc

$ knife solo init chef-repo
$ tree chef-repo/
chef-repo/
@dimitrov
dimitrov / gist:11290347
Created April 25, 2014 13:53
django-rosetta - Gunicorn auto reload
import os
from django.dispatch import receiver
from rosetta.signals import post_save
@receiver(post_save)
def restart_server(sender, **kwargs):
os.system('supervisorctl pid <gunicorn process> | xargs kill -HUP')
@liudong
liudong / gist:5353662
Created April 10, 2013 10:57
Python: Save something to a Excel spreadsheet
from openpyxl.workbook import Workbook
from openpyxl.writer.excel import ExcelWriter
from openpyxl.cell import get_column_letter
class XlsLogger(object):
"""
Save something to a Excel spreadsheet
"""
def __init__(self):
@raws
raws / curl.md
Created December 9, 2012 15:38 — forked from btoone/curl.md
A curl tutorial using GitHub's API

Introduction

An introduction to curl using GitHub's API

The Basics

Makes a basic GET request to the specifed URI

curl https://api.github.com/users/caspyin
@Kalyse
Kalyse / fabfile.py
Created August 28, 2012 11:15
Fab Start Stop of inotifywait script watching for LESS CSS Files
def startcss():
with lcd(r"%s/bin" % local_dir):
local("nohup ./checkCss.sh &> /dev/null < /dev/null &")
def stopcss():
local("ps -ef | grep \"checkCss\" | grep -v \"grep\" | awk '{print $2}' | xargs kill -9")
@josephwecker
josephwecker / new_bashrc.sh
Created August 11, 2012 04:36
Replace .bashrc, .bash_profile, .profile, etc. with something much more clean, consistent, and meaningful. Now a repo: https://github.com/josephwecker/bashrc_dispatch
#!/bin/bash
# License: Public Domain.
# Author: Joseph Wecker, 2012
#
# -- DEPRICATED --
# This gist is slow and is missing .bashrc_once
# Use the one in the repo instead! https://github.com/josephwecker/bashrc_dispatch
# (Thanks gioele)
#
# Are you tired of trying to remember what .bashrc does vs .bash_profile vs .profile?
#!/bin/bash
if [ ! -x /usr/bin/chef-solo ]; then
echo "ERROR: chef-solo not found"
echo "Try the chef-full package, http://opscode.com/chef/install"
exit 1
fi
BOOTSTRAP_TARBALL="http://osl.marshall.edu/chef/gitlab-bootstrap.tar.gz"
@sgmurphy
sgmurphy / podcast-ratings.php
Created February 21, 2012 19:31
Scrape ratings from iTunes store
<?php
/**
* Scrape the number of podcast reviews from iTunes for all country specific storefronts.
*
* @author Sean Murphy <sean@iamseanmurphy.com>
*/
$podcast_id = '366931951'; // Startups For the Rest of Us
//$podcast_id = '318567721'; // techzing
@cmer
cmer / gist:1566734
Created January 5, 2012 19:16
UnixBench comparison of EC2 and Joe's Data Center
apt-get install -y build-essential libx11-dev libgl1-mesa-dev libxext-dev perl perl-modules make
cd /tmp
wget http://byte-unixbench.googlecode.com/files/UnixBench5.1.3.tgz
tar xzvf UnixBench5.1.3.tgz
cd UnixBench
./Run