Skip to content

Instantly share code, notes, and snippets.

@johan
johan / octocat.svg
Created June 4, 2011 11:16
Github octocat avatar, SVG format
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sbp
sbp / project.bash
Created December 20, 2011 17:05
Mirror a user's gists
#!/bin/sh
GIST_USER=sbp
function usage() {
echo Usage: $0 [command], where command is one of:
echo update - Gets any new gists for user
echo pull - Keep existing gists synced with server
echo sync - Do an update then a pull
}
@myano
myano / AAAAAA.py
Last active December 27, 2016 12:55
Python script to check for latest episodes of television shows from tpb. Please use responsibility. Code not the cleanest nor most efficient. Improvements to come.
#!/usr/bin/env python
"""
AAAAAA.py
This script, when placed in a folder with other episodes, will find the next
episode number and query thepiratebay for the infohash of the most popular
match.
This script is only used to find shows that are freely available.
I personally enjoy Pioneer One and a bunch more films provided freely over at
@silasb
silasb / .htaccess
Created March 30, 2012 17:16
GZip JS/CSS
AddEncoding gzip gz
RewriteEngine On
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteCond %{REQUEST_FILENAME}.gz -f
RewriteRule ^(.*)$ $1.gz [QSA,L]
<Files *.css.gz>
ForceType text/css
@ikks
ikks / goo.gl.py
Created May 31, 2012 19:43
Using goo.gl from python 2.X Where X is 6 or more
#Given to the public domain
#No warranties
import urllib2
import simplejson
def shorturl(urltoshorten):
"""Compress the URL using goo.gl take a look at https://developers.google.com/url-shortener/v1/getting_started
>>> shorturl('http://igor.tamarapatino.org')
'http://goo.gl/FxHOn'
@rduplain
rduplain / slides.md
Last active February 7, 2019 15:40
Use Werkzeug's web-based interactive debugger with Tornado.

Interactive Debugging in any Python Web Project

Ron DuPlain - PyOhio 2013

Turn this:

@myano
myano / gist:5016700
Last active December 14, 2015 02:49
This will convert a given password "foobar" into the SHA output that Apache uses for it's .htpasswd files. You can take the output of this command and simply append it with a "username_here:{SHA}" and then place it into a .htpasswd is pointing at. This is useful if you want someone to generate a password for you but they don't have Apache instal…

Without salt:

$ echo -n "foobar" | sha1sum | cut -d' ' -f1 | xxd -r -p | base64

With salt:

$ USR="yourname";PWD="foobar";SALT="$(openssl rand -base64 3)";SHA1=$(printf "$PWD$SALT" | openssl dgst -binary -sha1 | sed 's#$#'"$SALT"'#' | base64); echo "$USR:{SSHA}$SHA1"

@myano
myano / join.py
Last active December 14, 2015 03:29
If you have saved your buffers in WeeChat with "/layout save", this script will print out an easy to copy/paste "/join #channel1,#channel2" that you can paste into WeeChat to join channels. If you have a lot of channels (more than 100). I would recommend joining only about 75-100 channels at a time.
#!/usr/bin/env python
import copy
f = open('weechat.conf', 'r')
formats = ['/join ', '/query ']
networks = {
@myano
myano / index.md
Last active August 25, 2021 11:56
Merging forked gists into your gist to preserve the history of the gist.

Merging A Forked Gist Into Your Gist

Let's say you have a gist (public or private) and someone forks it and makes changes to it. Awesome! However, now you want to merge in their changes to your gist. Unfortunately, it doesn't seem GitHub supports this via their website at the moment, however, you can still merge the gists with 'git' on the command line.

  1. You want to clone your gist. You can locate the link for this under "Clone this gist"

     ➜  ~/dev » git clone https://gist.github.com/5315168.git
     Cloning into '5315168'...
    

remote: Counting objects: 6, done.

@myano
myano / gitio.md
Last active December 16, 2015 23:39

Create git.io Short URLs in Python

git.io is an awesome URL shortener provided by Github. It works when shortening URLs from *.github.com/* to a small https://git.io/ link.

requests

&gt;&gt;&gt; import requests