Skip to content

Instantly share code, notes, and snippets.

@mbostock
mbostock / .block
Last active November 22, 2022 23:32
Line Transition
license: gpl-3.0
@marazmiki
marazmiki / daemon.py
Created September 4, 2012 07:53
Python daemon example
#!/usr/bin/env python
# coding: utf-8
import argparse
import os
import sys
import time
import atexit
import logging
import signal
@reggi
reggi / Possible European Country Code List #1
Last active August 24, 2020 22:55
Shopify Countries - European Country Codes.
AL Albania
AD Andorra
AM Armenia
AT Austria (also sometimes OE in German-speaking countries: for "Oesterreich"
BY Belarus
BE Belgium
BA Bosnia and Herzegovina
BG Bulgaria
CH Switzerland (from Confoederatio Helvetica)
CY Cyprus
@kimus
kimus / cx_oracle.md
Last active September 2, 2024 18:28
Installing python cx_oracle on Ubuntu

First of all, it just seems like doing anything with Oracle is obnoxiously painful for no good reason. It's the nature of the beast I suppose. cx_oracle is a python module that allows you to connect to an Oracle Database and issue queries, inserts, updates..usual jazz.

Linux

Step 1:

sudo apt-get install build-essential unzip python-dev libaio-dev

Step 2. Click here to download the appropriate zip files required for this. You'll need:

@rtt
rtt / tinder-api-documentation.md
Last active March 10, 2025 07:24
Tinder API Documentation

Tinder API documentation

Note: this was written in April/May 2014 and the API may has definitely changed since. I have nothing to do with Tinder, nor its API, and I do not offer any support for anything you may build on top of this. Proceed with caution

http://rsty.org/

I've sniffed most of the Tinder API to see how it works. You can use this to create bots (etc) very trivially. Some example python bot code is here -> https://gist.github.com/rtt/5a2e0cfa638c938cca59 (horribly quick and dirty, you've been warned!)

@Pentusha
Pentusha / waiter.py
Last active August 29, 2015 14:00
Function for tracking state of async tasks unexpectedly used to sort a list. Dumbest sorting ever.
def waiter(tasks):
""" async tasks to sync
tasks -> yield + tasks_wo_result
1 2 3 4
[0,0,0,0] -> [ ] + [0,0,0,0] 1, 3 solved
[1,0,3,0] -> [1,3 ] + [ 0, 0] 2 solved
[ 2, 0] -> [1,3,2 ] + [ 0] 4 solved
[ 4] -> [1,3,2,4] + [ ]
"""
while tasks:
@simlegate
simlegate / custom-error-page
Created October 31, 2014 05:35
Nginx return custom json
error_page 400 404 405 =200 @40*_json;
location @40*_json {
default_type application/json;
return 200 '{"code":"1", "message": "Not Found"}';
}
error_page 500 502 503 504 =200 @50*_json;
location @50*_json {
@fphilipe
fphilipe / exclude.sql
Last active January 9, 2025 19:26
PostgreSQL EXCLUDE constraint
CREATE EXTENSION btree_gist;
CREATE TABLE room_reservations (
room_id integer,
reserved_at timestamptz,
reserved_until timestamptz,
canceled boolean DEFAULT false,
EXCLUDE USING gist (
room_id WITH =, tstzrange(reserved_at, reserved_until) WITH &&
) WHERE (not canceled)
@chinshr
chinshr / Jenkinsfile
Last active February 9, 2025 02:39
Best of Jenkinsfile, a collection of useful workflow scripts ready to be copied into your Jenkinsfile on a per use basis.
#!groovy
# Best of Jenkinsfile
# `Jenkinsfile` is a groovy script DSL for defining CI/CD workflows for Jenkins
node {
}
@palankai
palankai / specification.py
Last active February 2, 2025 17:45
Python Specification Pattern
class Specification:
def __and__(self, other):
return And(self, other)
def __or__(self, other):
return Or(self, other)
def __xor__(self, other):
return Xor(self, other)