Skip to content

Instantly share code, notes, and snippets.

-- in-situ reversal
function reverse(t)
local n = #t
local i = 1
while i < n do
t[i],t[n] = t[n],t[i]
i = i + 1
n = n - 1
end
@obra
obra / vm-secureboot.md
Created February 28, 2018 08:08 — forked from gabrieljcs/vm-secureboot.md
Instructions on signing VirtualBox and VMware modules for Secure Boot

Signing VirtualBox & VMware modules

Source

Creating a key

You can change "MOK".priv/.der to any desired name; "CN=" MUST hold your username, signing the modules may not work otherwise (on shim, possibly due to a bug).

$ openssl req -new -x509 -newkey rsa:2048 -keyout MOK.priv -outform DER -out MOK.der -nodes -days 36500 -subj "/CN=John Doe/"
@obra
obra / create-iso.sh
Created July 24, 2017 04:45 — forked from julianxhokaxhiu/create-iso.sh
Simple bash script to create a Bootable ISO from macOS Sierra Install Image from Mac App Store
#!/bin/bash
#
# Credits to fuckbecauseican5 from https://www.reddit.com/r/hackintosh/comments/4s561a/macos_sierra_16a238m_install_success_and_guide/
# Adapted to work with the official image available into Mac App Store
#
# Enjoy!
hdiutil attach /Applications/Install\ macOS\ Sierra.app/Contents/SharedSupport/InstallESD.dmg -noverify -nobrowse -mountpoint /Volumes/install_app
hdiutil create -o /tmp/Sierra.cdr -size 7316m -layout SPUD -fs HFS+J
hdiutil attach /tmp/Sierra.cdr.dmg -noverify -nobrowse -mountpoint /Volumes/install_build

How to unbrick an Amazon Kindle Paperwhite™

This guide instructs you in how to unbrick an Amazon Kindle Paperwhite. The consequences of following it are your own responsibility. This method (opening the Kindle and using the serial interface) should be a last resort and should only be considered if other methods fail

The Guide

  1. Pry open Kindle using a prying tool
  2. Unscrew the screen and remove it from the base. Note that there's a screw hidden under the adhesive at the top in the middle
  3. Solder tin wire to serial ports on the bottom
  4. Attach tin wire to USB TTY device (order is ground, RX, TX, from the kindle's perspective, where GND is the smallest pad) and plug USB TTY device into your computer
  5. Open Putty on your computer in serial mode, with the serial port specified as your USB device and baud configured to 115200
@obra
obra / prep-for-seeed
Created August 20, 2014 23:38
A small script to prep kicad output to send to @seeedstudio
#!/bin/sh
pushd $1
for i in *.drl;
do mv $i `basename $i drl`txt;
done
for i in *Edge_Cuts.gbr;
do mv $i `basename $i Edge_Cuts.gbr`Edge_Cuts.gko;
done
popd
zip -r `date +%Y-%m-%d-`$1.zip $1
@obra
obra / gist:7226280
Last active December 26, 2015 22:49
My current Twitter userstyle
div.promoted-tweet { display: none }
.content-main { float: none; width: auto; }
.wtf-module, .mini-profile.module, .trends.module, .wtf-module.has-content, .profile-header, .module.site-footer { display: none }
.tweet-actions, .expand-stream-item { visibility: hidden }
.stream-item:hover .tweet-actions, .stream-item:active .tweet-actions, .selected-stream-item .tweet-actions, .stream-item:hover .expand-stream-item, .stream-item:active .expand-stream-item, .selected-stream-item .expand-stream-item { visibility: visible }
.wrapper { width: auto; padding-left: 0; padding-right: 0; }
.profile-card.profile-header { float: none; margin-left: auto; margin-right: auto; }
div.dashboard { clear: both; float: none; width: auto; position: absolute; }
.js-nav-links { display: block; height: 20px; background: #fff; }
.js-nav-links:before { font-size: 1.1em; font-weight: bold; margin: 0.5em; margin-bottom: 1em; padding-bottom: 1em; display: block; line-height: 1em; content: "Page navigation >"; }
@obra
obra / gist:4187042
Created December 2, 2012 05:08
horrible hack to get todayapp working with mongolab, sort of
diff --git a/samples/today-app/app/app.ls b/samples/today-app/app/app.ls
index 0bbcc7e..053358d 100644
--- a/samples/today-app/app/app.ls
+++ b/samples/today-app/app/app.ls
@@ -1,5 +1,5 @@
# Declare app level module which depends on filters, and services
-App = angular.module \app <[ngCookies ngResource app.controllers app.directives app.filters app.services]>
+App = angular.module \app <[ngCookies app.controllers app.directives app.filters app.services]>
App.config <[$routeProvider $locationProvider]> +++ ($routeProvider, $locationProvider, config) ->
@obra
obra / posa.mkdn
Created November 28, 2012 02:30 — forked from audreyt/posa.mkdn
EtherCalc Chapter for POSA

From SocialCalc to EtherCalc

Previously, in The Architecture of Open Source Applications, I described SocialCalc, an in-browser spreadsheet system that replaced the server-centric WikiCalc architecture. SocialCalc performs all of its computations in the browser; it uses the server only for loading and saving spreadsheets.

For the Socialtext team, performance was the primary goal behind SocialCalc's design in 2006. The key observation was this: Client-side computation in JavaScript, while an order of magnitude slower than server-side computation in Perl, was still much faster than the network latency incurred during AJAX roundtrips:

...diagram on SocialCalc's scalability model... (Since that time, advances in JavaScript runtimes have mostly closed the gap; note that in the diagram.)

Toward the end of the AOSA chapter, we introduced simultaneous collaboration on spreadsheets, using a simple, chatroom-like architecture:

@obra
obra / env.sample.js
Created December 30, 2011 19:49 — forked from jmreidy/env.sample.js
Pivotal to Sprintly importer
module.exports = {
pivotal: {
TOKEN: 'TOKEN'
PID: 'PID',
},
sprintly: {
USER: "USER_EMAIL",
ID: 'PRODUCT_ID',
KEY: 'API_KEY'
},
.
./.git
./.git/config
./.git/description
./.git/HEAD
./.git/hooks
./.git/hooks/applypatch-msg.sample
./.git/hooks/commit-msg.sample
./.git/hooks/post-commit.sample
./.git/hooks/post-receive.sample