Skip to content

Instantly share code, notes, and snippets.

const express = require('express');
const app = express();
// Application
app.get('/', function(req, res) {
if (process.env.NODE_ENV === 'development') {
for (var key in require.cache) {
delete require.cache[key];
}
}
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
// Define search commands. Depends on dialog.js or another
// implementation of the openDialog method.
// Replace works a little oddly -- it will do the replace on the next
// Ctrl-G (or whatever is bound to findNext) press. You prevent a
// replace by making sure the match is no longer selected when hitting
// Ctrl-G.
@harryfk
harryfk / mail.js
Last active January 29, 2017 22:31
// this is a Google Apps script which fetches a random gif from Giphy and then sends it via email to people
function sendMail(){
var url = "http://api.giphy.com/v1/gifs/random?api_key=dc6zaTOxFJmzC&tag=thanks";
var response = UrlFetchApp.fetch(url, {}).getContentText();
response = JSON.parse(response);
var subject = 'Your friendly time tracking reminder.';
var body = 'Please, would you track your time today? It only takes five minutes.\n\n ';
var sender = 'Annoying Harry';
@gbaman
gbaman / HowToOTGFast.md
Last active April 16, 2024 06:29
Simple guide for setting up OTG modes on the Raspberry Pi Zero, the fast way!

Setting up Pi Zero OTG - The quick way (No USB keyboard, mouse, HDMI monitor needed)

More details - http://blog.gbaman.info/?p=791

For this method, alongside your Pi Zero, MicroUSB cable and MicroSD card, only an additional computer is required, which can be running Windows (with Bonjour, iTunes or Quicktime installed), Mac OS or Linux (with Avahi Daemon installed, for example Ubuntu has it built in).
1. Flash Raspbian Jessie full or Raspbian Jessie Lite onto the SD card.
2. Once Raspbian is flashed, open up the boot partition (in Windows Explorer, Finder etc) and add to the bottom of the config.txt file dtoverlay=dwc2 on a new line, then save the file.
3. If using a recent release of Jessie (Dec 2016 onwards), then create a new file simply called ssh in the SD card as well. By default SSH i

@mjackson
mjackson / app.js
Created December 29, 2015 05:07
Using webpack with pixi.js
var PIXI = require('pixi.js')
console.log(PIXI)
@daxadax
daxadax / burgerbot.rb
Last active April 13, 2022 09:20
burgerbot
#!/usr/bin/env ruby
# modified from https://gist.github.com/pbock/3ab260f3862c350e6b5f #
require 'watir-webdriver'
class BurgerBot
def initialize
@attempt_count = 0
@chrisfinch
chrisfinch / gist:6367108
Created August 28, 2013 15:06
Gruntfile require.js optimisation config
// r.js concatenation and minification of javascript
requirejs: {
compile: {
options: {
name: "almond",
baseUrl: "lib/js/",
include: ['main'],
exclude: ['jquery'],
mainConfigFile: "lib/js/main.js",
out: "build/js/peaks.min.js",
@andrewn
andrewn / gist:6352695
Last active December 21, 2015 19:09
USB Soundcard default
To make a USB souncard default:
1. Open `sudo nano /etc/modprobe.d/alsa-base.conf`
2. Comment out the following line: `#options snd-usb-audio index=-2`
3. Reboot
4. Check that USB audio is at the top of this list `cat /proc/asound/modules`

Accept no meetings days

I operate a policy of having days in which I try hard to not have meetings. If you're reading this, chances are you've looked at my calendar and are wondering what kind of meeting takes all day and happens so frequently. It's not an actual meeting, it is a reservation of the day.

When you're operating on the maker's schedule, meetings are a disaster. A single meeting can blow a whole afternoon, by breaking it into two pieces each too small to do anything hard in.

Maker's Schedule, Manager's Schedule by Paul Graham

If you still need to book a meeting with me on a reserved day, go ahead. I'll accept it if I think it's more important than having time for coding and thinking and solving hard problems.

@rvagg
rvagg / README.md
Last active April 21, 2024 08:33
Kindleberry "Paperwhite" Pi

Work in progress, I'll write this up properly when I'm done.

Almost all credit goes to @maxogden for putting me on to this and pointing me in the right direction for each of these items.

Prerequisites:

  • Raspberry Pi
  • Kindle Paperwhite freed from its locked down state (jailbroken) http://www.mobileread.com/forums/showthread.php?t=198446
    • You have to downgrade your Kindle to 5.3.1 to install the current jailbreak; that's just a matter of getting the old version image, putting it on your Kindle via USB and telling it to install "upgrade". Then you put in the Jailbreak files, load the ebook and break.
  • Your kindle will be quick to detect an upgrade is available so it'll want to upgrade soon afterwards but the jailbreak will last but you have to reinstall the developer certificates so it's a bit of a pain but doable. Find all the instructions on the mobileread.com forums and wiki.