Skip to content

Instantly share code, notes, and snippets.

@leibowitz
leibowitz / got
Created November 3, 2014 14:53
Run go or git
#!/bin/bash
declare -a arr=("build" "clean" "env" "fix" "fmt" "get" "install" "list" "run" "test" "tool" "version" "vet")
[ ${arr[$1]+abc} ] && go $@ || git $@
@leibowitz
leibowitz / zone.kml
Created December 28, 2016 09:36
zone
<?xml version='1.0' encoding='UTF-8'?>
<kml xmlns='http://www.opengis.net/kml/2.2'>
<Document>
<name>London Transport Zone Map</name>
<description><![CDATA[This is a station accurate representation of the Transport for London Zone layout.<br><br>Zone information taken from http://www.tfl.gov.uk/assets/downloads/tube-dlr-trams-and-train-travelcard-zones-map.pdf]]></description>
<Folder>
<name>Untitled layer</name>
<Placemark>
<name>Zone 1</name>
<styleUrl>#poly-FFFFFF-3-115-nodesc</styleUrl>
@leibowitz
leibowitz / redshift_perm.sql
Created March 1, 2018 14:00
view permissions redshift table
SELECT *
FROM
(
SELECT
schemaname
,objectname
,usename
,HAS_TABLE_PRIVILEGE(usrs.usename, fullobj, ‘select’) AS sel
,HAS_TABLE_PRIVILEGE(usrs.usename, fullobj, ‘insert’) AS ins
,HAS_TABLE_PRIVILEGE(usrs.usename, fullobj, ‘update’) AS upd
@leibowitz
leibowitz / errors.txt
Created May 29, 2018 20:25
Rocket League
Library not loaded: @loader_path/libSDL2-2.0.0.dylib
brew install sdl2 --universal
dyld: Symbol not found: __pcre_utf8_table1_size
Referenced from: /Users/user/Library/Application Support/Steam/steamapps/common/rocketleague/RocketLeague.app/Contents/MacOS/TAGame
Expected in: /usr/lib/libpcre.0.dylib
in /Users/user/Library/Application Support/Steam/steamapps/common/rocketleague/RocketLeague.app/Contents/MacOS/TAGame
Abort trap: 6
@leibowitz
leibowitz / docker-images-cleanup.sh
Last active July 23, 2018 15:57
Delete docker images
#!/bin/sh
SAVEIFS=$IFS
DANGLING=`docker images -f dangling=true | grep -v REPOSITORY | tr -s ' ' | cut -d' ' -f3`
IFS=$'\n'
DANGLING=($DANGLING)
IFS=$SAVEIFS
if [ ${#DANGLING[@]} -gt 0 ]; then
echo ${#DANGLING[@]} "dangling images to delete:"
echo ${DANGLING[*]}
@leibowitz
leibowitz / autocomplete.py
Last active October 7, 2022 18:19
Django Autocomplete with limit_choices_to support
from django.contrib.admin.options import BaseModelAdmin
from django.contrib.admin.views.autocomplete import AutocompleteJsonView
from django.contrib.admin.widgets import (
AutocompleteSelect, AutocompleteSelectMultiple,
)
from django.utils.http import urlencode
from urllib.parse import unquote, quote_plus, parse_qsl
class AutocompleteUrl(object):
@leibowitz
leibowitz / countries.csv
Created November 6, 2018 15:22
Countries lat/lon
country latitude longitude name
AF 33.93911 67.709953 Afghanistan
AG 17.060816 -61.796428 Antigua and Barbuda
AI 18.220554 -63.068615 Anguilla
AN 12.226079 -69.060087 Netherlands Antilles
AO -11.202692 17.873887 Angola
AS -14.270972 -170.132217 American Samoa
AT 47.516231 14.550072 Austria
AU -25.274398 133.775136 Australia
BA 43.915886 17.679076 Bosnia and Herzegovina
@leibowitz
leibowitz / pyproject.toml
Last active March 11, 2020 14:10
pyproject.toml
[tool.poetry]
name = "myproject"
version = "0.0.1"
description = ""
authors = []
[tool.poetry.dependencies]
django-moneyfield = {git = "https://github.com/dangerfarms/django-moneyfield.git"}
[build-system]
@leibowitz
leibowitz / adapter.js
Last active July 29, 2024 08:28
AdminBro Many to Many component for sequelizejs
const { Database, Resource: SequelizeResource } = require('admin-bro-sequelizejs')
const { BaseRecord } = require('admin-bro')
const { Op } = require('sequelize')
class Resource extends SequelizeResource {
titleField() {
return this.decorate().titleProperty().name()
}
@leibowitz
leibowitz / USstates_avg_latLong
Last active September 8, 2020 12:37 — forked from meiqimichelle/USstates_avg_latLong
JSON of US states (full names) and their average lat/long
[
{
"state":"Alaska",
"latitude":61.3850,
"longitude":-152.2683
},
{
"state":"Alabama",
"latitude":32.7990,
"longitude":-86.8073