Skip to content

Instantly share code, notes, and snippets.

@gene1wood
gene1wood / get_redpocket_balance.py
Last active December 11, 2021 21:41
Tool to fetch a Redpocket account's balance of minutes, texts and data and write that in JSON to a file
import logging
from bs4 import BeautifulSoup
import requests
import yaml
import json
import os.path
import datetime
import re
import sys
@yossorion
yossorion / what-i-wish-id-known-about-equity-before-joining-a-unicorn.md
Last active April 7, 2024 22:55
What I Wish I'd Known About Equity Before Joining A Unicorn

What I Wish I'd Known About Equity Before Joining A Unicorn

Disclaimer: This piece is written anonymously. The names of a few particular companies are mentioned, but as common examples only.

This is a short write-up on things that I wish I'd known and considered before joining a private company (aka startup, aka unicorn in some cases). I'm not trying to make the case that you should never join a private company, but the power imbalance between founder and employee is extreme, and that potential candidates would

@vadimkantorov
vadimkantorov / argparse_dict_argument.py
Last active December 29, 2023 22:05
A one-line example enabling Python's argparse to accept dictionary arguments
# Example:
# $ python argparse_dict_argument.py --env a=b --env aa=bb
# Namespace(env={'a': 'b', 'aa': 'bb'})
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--env', action = type('', (argparse.Action, ), dict(__call__ = lambda a, p, n, v, o: getattr(n, a.dest).update(dict([v.split('=')])))), default = {}) # anonymously subclassing argparse.Action
print(parser.parse_args())
@gothma
gothma / ShutdownHandler.py
Created November 22, 2015 10:24
Python logging: Trigger exit on critical error
from __future__ import print_function
import logging
import sys
class ShutdownHandler(logging.Handler):
def emit(self, record):
print(record.msg, file=sys.stderr)
logging.shutdown()
sys.exit(1)
@techouse
techouse / sqlite3mysql.py
Last active May 29, 2023 13:37
A simple Python 3 script to transfer the data from SQLite 3 to MySQL. Requires MySQL Connector/Python 2.0.4 or higher.
#!/usr/bin/env python3
import logging
import sqlite3
import sys
import re
from math import ceil
from os.path import realpath, isfile
import mysql.connector
from mysql.connector import errorcode
@addyosmani
addyosmani / README.md
Last active April 2, 2024 20:18 — forked from 140bytes/LICENSE.txt
108 byte CSS Layout Debugger

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version

@pjambet
pjambet / parameterize.js
Created September 12, 2012 22:30
Javascript implementation of Rails #parameterize method stolen from http://bit.ly/TUm5wK and quickly modified
var LATIN_MAP = {
'À': 'A', 'Á': 'A', 'Â': 'A', 'Ã': 'A', 'Ä': 'A', 'Å': 'A', 'Æ': 'AE', 'Ç':
'C', 'È': 'E', 'É': 'E', 'Ê': 'E', 'Ë': 'E', 'Ì': 'I', 'Í': 'I', 'Î': 'I',
'Ï': 'I', 'Ð': 'D', 'Ñ': 'N', 'Ò': 'O', 'Ó': 'O', 'Ô': 'O', 'Õ': 'O', 'Ö':
'O', 'Ő': 'O', 'Ø': 'O', 'Ù': 'U', 'Ú': 'U', 'Û': 'U', 'Ü': 'U', 'Ű': 'U',
'Ý': 'Y', 'Þ': 'TH', 'ß': 'ss', 'à':'a', 'á':'a', 'â': 'a', 'ã': 'a', 'ä':
'a', 'å': 'a', 'æ': 'ae', 'ç': 'c', 'è': 'e', 'é': 'e', 'ê': 'e', 'ë': 'e',
'ì': 'i', 'í': 'i', 'î': 'i', 'ï': 'i', 'ð': 'd', 'ñ': 'n', 'ò': 'o', 'ó':
'o', 'ô': 'o', 'õ': 'o', 'ö': 'o', 'ő': 'o', 'ø': 'o', 'ù': 'u', 'ú': 'u',
'û': 'u', 'ü': 'u', 'ű': 'u', 'ý': 'y', 'þ': 'th', 'ÿ': 'y'
@catesandrew
catesandrew / add_movie_ratings.rb
Created April 26, 2011 17:22
add imdb ratings to your itunes movie collection
#!/usr/bin/env /usr/local/bin/ruby
require 'rubygems'
require 'appscript'
require 'imdb_party'
include Appscript
class LookupAPI