Skip to content

Instantly share code, notes, and snippets.

@rvause
rvause / setup.sh
Created April 30, 2011 11:17
Things to do after installing Ubuntu 11.04 (Natty Narwhal)
#!/usr/bin/env bash
### A simple set of instructions based on my opinions and preference ###
# To Begin
sudo add-apt-repository ppa:chromium-daily/beta
sudo add-apt-repository "deb http://archive.canonical.com/ubuntu natty partner"
sudo apt-get -y update && sudo apt-get -y upgrade
# Gnome tweaks
@rvause
rvause / setup.sh
Created May 3, 2011 11:55
Things to do after downgrading to Ubuntu 10.10 (Maverick)
#!/usr/bin/env bash
sudo jockey-text -u
sudo jockey-text -e xorg:nvidia_current
sudo sed -i 's/gb.archive/eu.archive/g' /etc/apt/sources.list
# To Begin
sudo add-apt-repository ppa:chromium-daily/beta
sudo add-apt-repository ppa:nikolay-blohin/gnotran
@rvause
rvause / watch.py
Last active September 25, 2015 23:18
Simple script to watch my internet connection when I am having trouble with my ISP. Checks every minute and logs a note if there's a problem
#!/usr/bin/env python
import time
import subprocess
from datetime import datetime
LOG_FILE = 'connection.log'
def check(ip):
@rvause
rvause / age.py
Created August 17, 2011 13:44
My partner got me totally confused about how old, I, and everyone else is; so this is to prove my own age to myself.
#!/usr/bin/env python
import sys
MONTHS_IN_YEAR = 11
class Age(object):
years = 0
@rvause
rvause / fourdown.py
Created August 23, 2011 17:00
Python script to download images from a thread on 4chan
#!/usr/bin/env python
'''
fourdown.py
A simple script to grab links to images found on a page.
You can use as is for downloading images from thread on 4chan or you can
import FourDown and do what ever you want with it.
@rvause
rvause / fuzzy_timesince.js
Created January 25, 2012 17:34
Fuzzy time since a given date
var fuzzy_timesince = function(when) {
parts = [
['year', 60 * 60 * 24 * 365],
['month', 60 * 60 * 24 * 30],
['week', 60 * 60 * 24 * 7],
['day', 60 * 60 * 24],
['hour', 60 * 60],
['minute', 60]
];
@rvause
rvause / urlencoder.py
Created February 16, 2012 17:39
Encoder for ids in urls in a Django app
import random
from base64 import b64encode, b64decode
from django.conf import settings
ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
class URLEncoder(object):
def __init__(self, secret, alphabet=ALPHABET, noise_length=12):
@rvause
rvause / gist:2769967
Created May 22, 2012 16:02
Doing something with Gantt, not sure what yet
import datetime
class Gantt(object):
""" Generate and manipulate Gantt charts """
def __init__(self, *args, **kwargs):
self.start = kwargs.pop(
'start',
datetime.datetime.now() - datetime.timedelta(7)
)
@rvause
rvause / tumblr_theme_fail.py
Created July 4, 2012 19:38
Failed experiment trying to make an authenticated post to the theme customization url.
from flask import Flask, session, redirect, request
from tumblpy import Tumblpy
app = Flask(__name__)
app.config['SECRET_KEY'] = 'x'
consumer_key = 'x'
consumer_secret = 'x'
@rvause
rvause / basemodel.py
Created July 31, 2012 15:45
model base for my Django projects (small but it might grow (or even shrink D:))
from django.db import models
class BaseModel(models.Model):
def update(self, **kw):
for k, v in kw.items():
setattr(self, k, v)
self.save()
class Meta: