Skip to content

Instantly share code, notes, and snippets.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
// Distances are in thousands of an inch
width = 1000; // One inch wide
length = 6000; // Six inches long
base_thickness = 250; // Quarter inch thickness
camera_holder_ring_thickness = base_thickness;
module camera_holder_ring() {
translate([0,width,0])
@croepha
croepha / dump_safari_history.py
Created July 5, 2014 01:56
Python script to get history from safari, because safari won't give you the time the site was visited
import plistlib, os.path, datetime, pytz, tzlocal, sys
_, start_days, end_days = sys.argv
start_days = int(start_days)
end_days = int(end_days)
apple_epoch = datetime.datetime(
@croepha
croepha / pre_chroot.sh
Last active January 15, 2022 05:36
My diskless ubuntu setup
#!/bin/sh
# Set R to chroot location
# set SERVER_IP to the ip address of the server
R=$HOME/pxe_ubuntu
# SERVER_IP="192.168.4.198"
LAN_L2="eth2"
WAN_L2="eth0"
LAN_ADDRESS=10.77.5.1
LAN_NETWORK=10.77.5.0
@croepha
croepha / django_pycharm.py
Last active July 28, 2022 13:02
This will activate an attached PyCharm or PyDev debugger on a django 500 error
# This will activate an attached PyCharm or PyDev debugger on a django 500
# error
# This makes it so that you dont have to set a breakpoint
# To use this, run the project in PyCharm or PyDev in debug mode, paste
# or import this code somewhere ( i usually just paste it in urls.py )
# inspired by these:
# https://github.com/jlubcke/pytest-pycharm/blob/master/pytest_pycharm.py
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
// This will open up a prompt for text to send to a console session on digital ocean
// Useful for long passwords
(function () {
var t = prompt("Enter text to be sent to console, (This wont send the enter keystroke)").split("");
function f() {
var character = t.shift();
var i=[];
var code = character.charCodeAt();
var needs_shift = "!@#$%^&*()_+{}:\"<>?~|".indexOf(character) !== -1
// units are in mm
// dims of amp
amp_outside_width = 150; // about 6 inches
amp_outside_height = 40;
amp_fin_depth = 10; // less than half an inch
amp_fin_thickness = 2;
amp_fin_inside_distance = 5;
@croepha
croepha / main.cpp
Last active December 7, 2016 16:38
work in progress software renderer for 3d
/*
watch -n.1 "clang++ --std=c++11 -g main.cpp -shared -o _target.so && mv _target.so target.so"
Ortho: http://i.imgur.com/bJ3VqNz.png
# clang++ --std=c++11 -g main.cpp -o target && ./target
*/
#include <assert.h>
#include <stdio.h>