Skip to content

Instantly share code, notes, and snippets.

View bikemule's full-sized avatar
💭
Emaxxxing

bikemule

💭
Emaxxxing
  • Kraken Technologies
  • Brooklyn, NY
View GitHub Profile
@bikemule
bikemule / gist:3dce8a886c9b80f6801f
Created March 9, 2015 18:20
brew install pgmagick error OS X 10.9.4
/usr/local/include/boost/python/class.hpp:266:11: note: candidate function template not viable: requires 5 arguments, but 2 were provided
self& def(char const* name, Fn fn, A1 const& a1, A2 const& a2, A3 const& a3)
^
1 error generated.
error: command 'clang' failed with exit status 1
@bikemule
bikemule / gist:4973606b6ffae233608d
Created March 9, 2015 18:56
pip install pgmagick error log
This file has been truncated, but you can view the full file.
Collecting django==1.6.6 (from -r requirements.txt (line 1))
Downloading Django-1.6.6-py2.py3-none-any.whl (6.7MB)
Collecting psycopg2==2.5 (from -r requirements.txt (line 2))
Downloading psycopg2-2.5.tar.gz (703kB)
Collecting pycurl==7.19.0 (from -r requirements.txt (line 3))
Downloading pycurl-7.19.0.tar.gz (70kB)
Using curl-config (libcurl 7.30.0)
Collecting dateutils==0.6.6 (from -r requirements.txt (line 4))
Downloading dateutils-0.6.6.tar.gz
# Trying to explain self in Python
class Number:
class_value = 1
def __init__(self, value):
# self is used here to refer to the newly created obj because __init__ is magic and it's a constructor
# All OO langs have to have constructors
self.value = value
'''
Don't know why I wanted to document this in such detail, but here it is.
From: https://fivethirtyeight.com/features/how-fast-can-you-type-a-million-letters/
Some number, N, of people need to pee, and there is some number, M, of urinals
in a row in a men's room. The people always follow a rule for which urinal they
select: The first person goes to one on either far end of the row, and the rest
try to maximize the number of urinals between them and any other person. So the
second person will go on the other far end, the third person in the middle, and
/*
select * from crime_scene_report where type='murder' and city='SQL City';
date type description city
20180215 murder REDACTED REDACTED REDACTED SQL City
20180215 murder Someone killed the guard! He took an arrow to the knee! SQL City
20180115 murder Security footage shows that there were 2 witnesses. The first witness lives at the last house on "Northwestern Dr". The second witness, named Annabel, lives somewhere on "Franklin Ave". SQL City
select * from interview where person_id in (select id from person where address_street_name like '%Northwestern Dr%' or address_street_name like '%Franklin Ave%');
Perhaps a way to narrow it down more, but the last two rows say:
@bikemule
bikemule / graph_models.sh
Last active March 21, 2020 14:41
Django model graph of specific apps, grouped by app, without inheritance
# Graph the models of specified apps.
# manage.py graph_models arguments:
# -g = Group models by app.
# -E = Do not show model inheritance.
# --output output_file, used with --pygraphviz
# `date --rfc-3339=date` = YYYY-MM-DD
python manage.py graph_models --pygraphviz -gE --output modelsgraph-`date --rfc-3339=date`.png appname1 appname2
@bikemule
bikemule / portfinder.sh
Created June 3, 2022 22:59
bash function to find a
# Find what port a program is using
function portfinder() {
# Find out what port a program is using.
# First and only argument is the process name
# used to grep output of ps command
# Usage: portfinder name_of_process
# Example output:
# node 87825 user 35u IPv4 0xaffd45cf13a62c85 0t0 TCP *:62883 (LISTEN)
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 10.
Title,Subtitle,Author,Binding,Grade,Dust Jacket,Jacket Grade,Notes,Editor,Year,Publisher
The Bell,,Iris Murdoch,HC,,FALSE,,,,,
The Group,,Mary Mccarthy,HC,,TRUE,,,,,
Mary Daly,,Outercourse,HC,,TRUE,,1st edition,,,
An Unofficial Rose,,Iris Murdoch,HC,,TRUE,,,,,
Psion,,Joan D. Vinge,SC,,FALSE,,1st edition,,,
The Complete Poetical Works of Shelley,,Percy Bysshe Shelley,HC,,FALSE,,,Thomas Hutchinson,1925,Oxford
A Primer of Book Collecting,,,HC,,TRUE,,Third revised edition,,,
Watchtower,,Lynn,HC,,TRUE,,,,,
Casa Guidi Windows and Other Poems,,Elizabeth Barrett Browning,HC,,FALSE,,"Oxford Miniature Edition
@bikemule
bikemule / getYouTubeTranscriptsBookmarklet.js
Created September 15, 2024 15:44
Copy YT transcripts to a textarea in a dialog, with or without timestamps
const container = document.createElement('dialog');
function createDialog() {
const close = document.createElement('button');
container.setAttribute('style', 'width:fit-content;letter-spacing:1px;background-color:#ddd;font-family:helvetica !important;font-weight:100;border-radius:12px;padding-inline:20px;color:#161613;border-color:#fff;position:fixed;inset:0;margin:auto;width:100%;max-width:400px;z-index:2147483647;font-size:18px;text-rendering:optimizeLegibility;text-align:left;line-height:36px;');
close.setAttribute('style', 'position:absolute;right:10px;top:8px !important;background-color:white;border-radius:50%;color:black;z-index:30;padding:0 0 0 1px;font-size:15px;font-weight:100;width:20px;height:20px;cursor:pointer;display:flex;justify-content:center;align-items:flex-start;border:1px solid black;line-height:16px;');
close.textContent = 'x';
close.onclick = () => container.remove();