Skip to content

Instantly share code, notes, and snippets.

@codeinthehole
codeinthehole / decorators.py
Created February 7, 2013 16:39
Basic auth for Django snippet
import base64
from django.http import HttpResponse
from django.contrib.auth import authenticate
from django.conf import settings
def view_or_basicauth(view, request, *args, **kwargs):
# Check for valid basic auth header
if 'HTTP_AUTHORIZATION' in request.META:
@jacobd
jacobd / taktech.js
Created October 30, 2023 17:40
taktech Web FM synth keyboard binding
// paste in the js console of https://www.taktech.org/takm/WebFMSynth/
const k1wwhich = { 65: 18, 83: 19, 68: 20, 70: 21, 71: 22, 72: 23, 74: 24, 75: 25, 76: 26, 186: 27, 222: 28, 87: 3, 69: 4, 84: 5, 89: 6, 85: 7, 79: 8, 88: 9, 221: 10 }, km = {}; const noteTable = [ new NoteTableItem(28, 0, 44, 110, 54), new NoteTableItem(89, 0, 44, 110, 56), new NoteTableItem(150, 0, 44, 110, 58), new NoteTableItem(233, 0, 44, 110, 61), new NoteTableItem(303, 0, 44, 110, 63), new NoteTableItem(386, 0, 44, 110, 66), new NoteTableItem(447, 0, 44, 110, 68), new NoteTableItem(508, 0, 44, 110, 70), new NoteTableItem(590, 0, 44, 110, 73), new NoteTableItem(660, 0, 44, 110, 75), new NoteTableItem(743, 0, 44, 110, 78), new NoteTableItem(804, 0, 44, 110, 80), new NoteTableItem(866, 0, 44, 110, 82), new NoteTableItem(0, 0, 9, 188, 52), new NoteTableItem(9, 0, 51, 188, 53), new NoteTableItem(60, 0, 51, 188, 55), new NoteTableItem(111, 0, 51, 188, 57), new NoteTableItem(162, 0, 51, 188, 59), new NoteTableItem(213, 0, 51, 188, 60), new
@typokign
typokign / zoomsucks.md
Last active September 8, 2023 05:06
Zoom Sucks

Zoom Sucks

  • Zoom abuses the installer flow on MacOS to bypass permissions dialogs (source)
  • Zoom sends identifying device info to Facebook, even when users don't have a Facebook account (source) (fixed)
  • A bug in Zoom sent identifying information (including email addresses and profile pictures) of thousands of users to strangers (source)
  • Zoom claims that meetings are end-to-end encrypted in their white paper and marketing materials, but meetings are only encrypted in transit, and are available in plaintext to Zoom servers and employees. (source)
  • zoomAutenticationTool can be used to escalat
@samwelkanda
samwelkanda / django_digitalocean.md
Created May 2, 2019 13:17
A step by step process of deploying a django project to digital ocean

Django Deployment to Ubuntu 18.04

In this guide I will go through all the steps to create a VPS, secure it and deploy a Django application. This is a summarized document from this digital ocean doc

Any commands with "$" at the beginning run on your local machine and any "#" run when logged into the server

Create A Digital Ocean Droplet

Use this link and get $10 free. Just select the $5 plan unless this a production app.

@markSci5
markSci5 / Git checkout remote branch
Created July 3, 2013 07:08
Git checkout remote branch
//To fetch a branch, you simply need to:
git fetch origin
//This will fetch all of the remote branches for you. With the remote branches
//in hand, you now need to check out the branch you are interested in, giving
//you a local working copy:
git checkout -b test origin/test
@EyalAr
EyalAr / client.py
Created December 11, 2013 18:17
Demo code for my post about python's blocking stream reading functions.
from subprocess import Popen, PIPE
from time import sleep
# run the shell as a subprocess:
p = Popen(['python', 'shell.py'],
stdin = PIPE, stdout = PIPE, stderr = PIPE, shell = False)
# issue command:
p.stdin.write('command\n')
# let the shell output the result:
sleep(0.1)
@smitelli
smitelli / ti250tool.py
Created May 31, 2022 19:51
Klein Tools TI250 image tool
# Klein Tools TI250 image tool by Scott Smitelli. Public domain.
# Requires at least Python 3.6 (developed and tested on 3.9)
# See https://www.scottsmitelli.com/articles/klein-tools-ti250-hidden-worlds
import argparse
import numpy as np
import re
import struct
from PIL import Image, ImageDraw
@endolith
endolith / export_google_starred_locations.py
Created October 16, 2012 02:29
Export Google Maps starred locations
# -*- coding: utf-8 -*-
"""
Go to Google Bookmarks: https://www.google.com/bookmarks/
On the bottom left, click "Export bookmarks": https://www.google.com/bookmarks/bookmarks.html?hl=en
After downloading the html file, run this script on it to generate a KML.
"""
@jsundram
jsundram / cull.py
Last active April 5, 2023 15:22
Check if lat long is inside the bounds of the continental US (box model, not shape)
# http://en.wikipedia.org/wiki/Extreme_points_of_the_United_States#Westernmost
top = 49.3457868 # north lat
left = -124.7844079 # west long
right = -66.9513812 # east long
bottom = 24.7433195 # south lat
def cull(latlngs):
""" Accepts a list of lat/lng tuples.
returns the list of tuples that are within the bounding box for the US.
NB. THESE ARE NOT NECESSARILY WITHIN THE US BORDERS!
@gekart
gekart / mnlgxd.py
Last active March 2, 2023 06:27
KORG minilogue xd PROG file parser and pretty printer
# Use this file to parse the structure of your minilogue programs and libraries (sound banks)
# this makes it easy to understand and document a finished sound
# run "python mnlgxd.py test.mnlgxdprog" to print the sound in a program name test.mnlgxdprog
# or "python mnlgxd.py test.mnlgxdlib 1" to print the second sound in the bank named test.mnlgxdlib
import struct, sys, zipfile, fpdf
fileStructure = [
("MAGIC", "<4s"),
("PROGRAM NAME", "12s"),