Skip to content

Instantly share code, notes, and snippets.

View mechanical-snail's full-sized avatar

Mechanical snail mechanical-snail

View GitHub Profile
@senko
senko / singleton.py
Created February 25, 2013 08:01
Singleton Django Model
# Written by Senko Rasic <senko.rasic@goodcode.io>
# Released into Public Domain. Use it as you like.
from django.db import models
class SingletonModel(models.Model):
"""Singleton Django Model
Ensures there's always only one entry in the database, and can fix the
@Glench
Glench / tv_tropes_common_tropes.py
Last active January 8, 2021 08:32
A command-line script to find the common tropes of two or more media items. To use, you need to install the python libraries 'pattern' and 'pyquery'. Then use like this, passing in media names or links to tv tropes pages: > python tv_tropes_common_tropes.py 'My Little Pony Friendship is Magic' 'Hamlet'
#!/usr/bin/python
# a script to get all the common tropes for media from tv tropes
# usage:
# python tv_tropes_matcher.py name1 name2 [name3...nameN]
# please put names with spaces or special characters in quotes
# you can also pass in the urls if it won't automatch by name.
# pip install pattern
# pip install pyquery

Releasing Kivy

$(version) = 1.0.7
$(version+1) = 1.0.8

Tag the current version

@jasisk
jasisk / kittens.js
Created February 3, 2012 02:43
kittens!!!
javascript:(function(){var a=document.getElementsByTagName('img'),i=a.length;while(b=a[--i]){b.setAttribute('src','http://placekitten.com/'+b.width+'/'+b.height);}}());
@jorgeortiz85
jorgeortiz85 / JavaConversionsEvil.scala
Created January 22, 2012 12:44 — forked from seanparsons/gist:1656555
scala.collection.JavaConversions is evil
import scala.collection.JavaConversions._
case class Foo(s: String)
val map: Map[Foo, String] =
Map(
Foo("a") -> "a",
Foo("b") -> "b")
val v = map.get("a") // should be a type error, actually returns null
@amanelis
amanelis / fork_block.c
Created December 6, 2010 07:21
The most effective un-stoppable fork bomb....ever
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <signal.h>
int main (void) {
struct sigaction act_int, act_ter;
sigset_t newsigset;
@azu
azu / pixiv API.user.js
Created January 5, 2010 13:57
Pixivの検索API叩く
// ==UserScript==
// @name pixiv API
// @namespace http://efcl.info/
// @include http://www.pixiv.net/*
// ==/UserScript==
// API 資料 http://pastie.org/735195
var pxvAPI = "http://iphone.pxv.jp/iphone/"
// 検索結果のオブジェクト
var result = [];
var user = {