Skip to content

Instantly share code, notes, and snippets.

@datagrok
datagrok / gist:2199506
Last active April 8, 2023 17:36
Virtualenv's `bin/activate` is Doing It Wrong
@crstamps2
crstamps2 / jsonPuller
Created July 14, 2012 15:22
A Google apps script to pull json from a spreadsheet
function doGet(){
var ss = SpreadsheetApp.openById("//key ommitted");
return exportJSON(ss);
}
// Exports current sheet as JSON and displays in message box.
function exportJSON(ss) {
var sheet = ss.getSheetByName("sessions");
var rowsData = getRowsData(sheet);
@abeluck
abeluck / gpg-offline-master.md
Last active October 22, 2023 02:59 — forked from KenMacD/cmd.md
GPG Offline Master Key w/ smartcard
@phillbaker
phillbaker / lmu.m
Created November 17, 2012 20:23
Macbook ambient light sensor data
// Compile with $ gcc -o lmutracker lmu.m -framework IOKit -framework CoreFoundation -framework Foundation
// Usage: ./lmu [now]
// Prints out the value from the ambient light sensor and the back light LED every 1/10 of a second. Optionally print just one value.
// Inspired by the code found at
// http://google-mac-qtz-patches.googlecode.com/svn-history/r5/trunk/AmbientLightSensor
// and http://osxbook.com/book/bonus/chapter10/light/
// and http://en.wikipedia.org/wiki/Wikipedia:Reference_desk/Archives/Computing/2010_February_10#Mac_OS_X_keyboard_backlight_drivers
// http://forums.macrumors.com/showthread.php?t=1133446
#include <stdio.h>
@markjlorenz
markjlorenz / mutt_notes.markdown
Last active July 25, 2021 18:16
Notes on getting Mutt running on OSX
  • brew install mutt
  • setup an app password for mutt in gmail
  • setup an app password for imap_notifier in gmail
  • brew install terminal-notifier terminal-notifier
  • gem install imap_notifier imap_notifier
  • brew install urlview
  • brew install w3m (links would be OK too)
  • Install pandoc to author in markdown and send as HTML

~/.muttrc

@DanHerbert
DanHerbert / fix-homebrew-npm.md
Last active June 4, 2024 04:16
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

OBSOLETE

This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.

I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

@bellbind
bellbind / speech.swift
Last active March 9, 2020 10:41
[osx][swift]Example of Text-to-Speech as commandline program
// Text-to-Speech on OSX
// run: swift speech.swift "東京特許許可局"
// build: xcrun -sdk macosx swiftc speech.swift && ./speech "東京特許許可局"
//
// for OSX, use NSSpeechSYnthesizer in AppKit,
// (for iOS, use AVSpeechSynthesizer in AVFoundation)
import Foundation
import AppKit
@mattdesl
mattdesl / tile-folder.js
Last active January 23, 2016 16:43
devtool script to tile images into a single image
// install with:
// npm i -g devtool
// npm i img javascript-natural-sort electron-canvas-to-buffer
//
// run:
// devtool tile-folder.js -qch
var fs = require('fs')
var path = require('path')
var loadImage = require('img')
@dario2994
dario2994 / generate_hcn.py
Last active May 4, 2024 16:39
Highly composite numbers list
#!/usr/bin/env python3
# This program prints all hcn (highly composite numbers) <= MAXN (=10**18)
#
# The value of MAXN can be changed arbitrarily. When MAXN = 10**100, the
# program needs less than one second to generate the list of hcn.
from math import log
MAXN = 10**18
@akatrevorjay
akatrevorjay / dd-resume.sh
Last active May 7, 2023 14:52
Resume partial dd transfer
#!/bin/bash -e
# Blocksize to truncate to and buffer by
BS=${BS:-4096}
SELF="`basename $0`"
death() { echo "$SELF:" "$@" >&2; exit 1; }
[ $# -eq 2 ] || death "Usage: $SELF original copy"
SRC="$1"; DST="$2"