Skip to content

Instantly share code, notes, and snippets.

Avatar

Wim Mostmans Sitebase

View GitHub Profile
@Everlanders
Everlanders / LightMonitor.py
Created Mar 13, 2018
Headlight and Reverse Lights monitor for YouTube Commenters - UNTESTED but should work fine.
View LightMonitor.py
#!/usr/bin/python
# A quick hack of my button monitor script to monitor headlights and reverse lights to
# Dim the screen and switch to the reverse camera.
# I have not tested this...
# Remember, the switch or opto is switching to ground, so the logic is inverted... 0 = on 1 = off
# Also, you would run only one of these "Monitor" scripts. you can't be running RearviewMonitor.py AND LightMonitor.py
import RPi.GPIO as GPIO
import time
import subprocess, os
@iampeter
iampeter / gist:5af9c9e113e41c954364
Last active Apr 14, 2020
Simple proxy with hapi.js to fix your CORS problems
View gist:5af9c9e113e41c954364

Problem

While building a JavaScript single page app that acts as a front-end to multiple backend servers, even if they are on the same host as the web app - but on different ports, you come across CORS issues.

Solution

Use a simple node.js + hapi.js server to:

  1. Serve your static single page app
  2. Act as proxy to the backend servers
@raine
raine / heroku-logs-with-bunyan.md
Last active Aug 3, 2018
Read heroku log output with bunyan
View heroku-logs-with-bunyan.md

Read heroku logs output w/ bunyan

The stuff before the JSON in heroku logs output has to be cut off for bunyan to work.

$ heroku logs | sed -l 's/.*app\[web\..*\]\: //' | bunyan

Flag -l makes the output buffered by line.

@s-panferov
s-panferov / class_manager.ts
Last active Aug 29, 2015
BEM ClassManager
View class_manager.ts
module classes {
export interface ClassManager {
mod(...name: string[]): ClassManager;
cmod(condition: boolean, ...name: string[]): ClassManager;
toString(): string;
before(...other: ToString[]): ClassManager;
after(...other: ToString[]): ClassManager;
}
@staltz
staltz / introrx.md
Last active May 15, 2021
The introduction to Reactive Programming you've been missing
View introrx.md
@nickytoh
nickytoh / iCloud API Demo in Node.js
Last active Aug 8, 2018
Request Contact List From iCloud
View iCloud API Demo in Node.js
var uuid = require('node-uuid'),
https = require('https');
function iCloud(appleId, password) {
this.urls = {
"version" : "https://www.icloud.com/system/version.json",
"validate": "/setup/ws/1/validate?clientBuildNumber={0}&clientId={1}",
"login": "/setup/ws/1/login?clientBuildNumber={0}&clientId={1}"
}
@stephen
stephen / eventTester.js
Created May 11, 2014
node-sonos eventing framework
View eventTester.js
var Sonos = require('../index').Sonos;
var Listener = require('../lib/events/listener');
var x = new Listener(new Sonos(process.env.SONOS_HOST || '192.168.2.11'));
x.listen('/ZoneGroupTopology/Event', function(err, sid) {
console.log(sid);
});
@shubik
shubik / gist:10955038
Created Apr 17, 2014
requirejs onBuildWrite to remove jsx!
View gist:10955038
onBuildWrite: function (moduleName, path, contents) {
return contents.replace(/jsx!/g, '');
}
@mikhailov
mikhailov / gist:9639593
Last active Apr 20, 2021
Nginx S3 Proxy with caching
View gist:9639593
events {
worker_connections 1024;
}
http {
default_type text/html;
access_log /dev/stdout;
sendfile on;
keepalive_timeout 65;
@harith
harith / shellmarks.sh
Last active Nov 8, 2018
Utilities to let you easily reach frequently visited but deeply nested directories.
View shellmarks.sh
# Utilities for quickly accessing frequently used directories in bash.
# Usage:
# $ cd /path/to/project/src/
# $ mark code # Will create a new shortcut.
# # Becomes interactive if a shortcut already exists
# # m is an alias for mark. You can also `m code`
#
# $ code # From now on, running this anywhere in the shell
# # will put you in /path/to/project/src/code