This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
module MyModule | |
module MyHelper | |
module_function def helpermethod | |
puts "helpermethod" | |
end | |
end | |
private_constant :MyHelper |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Public domain. Use and abuse and tell me if you make it prettier, | |
# like, add a "--prefix" option or figure out where to put .desktop | |
# files or link the binary to... | |
echo -n "Looking up latest version, " | |
verurl="https://github.com/signalapp/Signal-Desktop/releases" | |
pkgver=$(curl -s "${verurl}" | grep "/signalapp/Signal-Desktop/releases/tag/" -m 1 | grep -oP '[\d\.]*') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <math.h> | |
unsigned const int led_count = 5; | |
int led_pin[led_count] = {10, 9, 6, 5, 3}; | |
const unsigned int min_val = 25; // never go dark completely | |
const unsigned int max_val = 255; // don't kill the LEDs (atm there are no resistors) | |
void setup() | |
{ | |
Serial.begin(9600); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
LOCS="/a /couple /of /paths" | |
DEST="/some/path" | |
HOST="user@host" # assuming pubkey auth | |
AORB="$((`date +%m` % 2))" | |
[[ $AORB = 1 ]] && AORB="a" || AORB="b" | |
set -x |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
cut -d':' -f'1,6' /etc/passwd | while IFS=: read username userhome; do | |
rcfile="$userhome/.rc" | |
if case $rcfile in "/home"*) true;; *) false;; esac; then | |
if test -x "$rcfile"; then | |
su -c "$rcfile" "$username" | |
fi | |
fi | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <limits.h> // allow use of ranges in switch-case statements (1 ... 2, etc.) | |
#include "RunningAverage.h" | |
#define POWER_SUPPLY 3.3 // volts | |
#define ADC_MAX_VAL 4095 // 12 bits of resolution | |
#define ADC_MAX_V POWER_SUPPLY // some docs say not to go higher than 1V, some say 3V3 is fine | |
#define LED0 2 | |
#define LED1 19 | |
#define LED2 21 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'nokogiri' | |
require 'csv' | |
CSV.open('LNDW.csv', 'a+') do |csv| | |
Dir.glob('html/*.html') do |filename| | |
puts "Processing #{filename}..." | |
doc = Nokogiri::HTML(File.read(filename)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@font-face { | |
font-family: "Serto Jerusalem"; | |
src: url("/assets/SertoJerusalem.eot?#iefix") format("embedded-opentype"), url("/assets/SertoJerusalem.woff2") format("woff2"), url("/assets/SertoJerusalem.woff") format("woff"), url("/assets/SertoJerusalem.ttf") format("truetype"); } | |
@font-face { | |
font-family: "Serto Jerusalem"; | |
src: url("/assets/SertoJerusalemBold.eot?#iefix") format("embedded-opentype"), url("/assets/SertoJerusalemBold.woff2") format("woff2"), url("/assets/SertoJerusalemBold.woff") format("woff"), url("/assets/SertoJerusalemBold.ttf") format("truetype"); | |
font-weight: bold; } | |
@font-face { | |
font-family: "Serto Jerusalem"; | |
src: url("/assets/SertoJerusalemItalic.eot?#iefix") format("embedded-opentype"), url("/assets/SertoJerusalemItalic.woff2") format("woff2"), url("/assets/SertoJerusalemItalic.woff") format("woff"), url("/assets/SertoJerusalemItalic.ttf") format("truetype"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define F_CPU 1000000UL // keep internal clock at 1 MHz, should be sufficient | |
#include <TinyWireM.h> // required by TinyDS1307 | |
#include <USI_TWI_Master.h> // using I2C via the chip's USI | |
#include <TinyDS1307.h> // using the RTC - ATTN: the header needed changing to set the RTCs | |
// memory size to 0 because setting it to its actual value (56 bytes) | |
// grows the sketch beyond bounds! | |
#include <PinChangeInterrupt.h> // using PCINTs instead of INTs | |
#include <avr/io.h> // direct port manipulation | |
#include <util/delay.h> // to have a substitute for delay() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Taken from https://stackoverflow.com/questions/9838812/how-can-i-open-a-json-file-in-javascript-without-jquery | |
function loadJSON(path, success, error) { | |
var xhr = new XMLHttpRequest(); | |
xhr.onreadystatechange = function() | |
{ | |
if (xhr.readyState === XMLHttpRequest.DONE) { | |
if (xhr.status === 200) { | |
if (success) { | |
success(JSON.parse(xhr.responseText)); | |
} |