Skip to content

Instantly share code, notes, and snippets.

Avatar

Erik Eng ptz0n

View GitHub Profile
@ptz0n
ptz0n / README.md
Last active Jan 2, 2019
Serve favicons to all clients
View README.md

There is a lot of files needed to make all clients happy and show a nice favicon. This note make things a bit simpler by having a set of sizes ready and rewriting request paths.

  1. Make sure you have these sizes available, square works best:
16.png
32.png
36.png
48.png
57.png
60.png
@ptz0n
ptz0n / 2018-04-27T05_59_31_179Z-debug.log
Created Apr 27, 2018
node_mdns install failure, node v10
View 2018-04-27T05_59_31_179Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/Users/eng/.nvm/versions/node/v10.0.0/bin/node',
1 verbose cli '/Users/eng/.nvm/versions/node/v10.0.0/bin/npm',
1 verbose cli 'install' ]
2 info using npm@6.0.0
3 info using node@v10.0.0
4 verbose npm-session 0b7b9e31f8126457
5 silly install runPreinstallTopLevelLifecycles
6 silly preinstall mdns@2.3.4
7 info lifecycle mdns@2.3.4~preinstall: mdns@2.3.4
View test_utils.php
<?php
/**
* Test utilities
*/
/**
* Deterministically figure out if seed is within test group
*
* @param string|integer $seed Seed to use, user ID's, paths etc.
* @param integer $procentage Sets the inclusive group size. Defaults to 50 %.
View homebridge-garage-door.js
// Inspiration: https://github.com/danielreiser/Homebridge-Simple-Garage-Door-Opener/blob/master/index.js
// Inspiration: https://github.com/benlamonica/homebridge-rasppi-gpio-garagedoor/blob/master/index.js
let Service = null;
let Characteristic = null;
let CurrentDoorState = null;
const PLUGIN_NAME = "homebridge-garage";
const ACCESSORY_NAME = "garage-door";
@ptz0n
ptz0n / template.js
Created Sep 29, 2016
Enjoy Analytics
View template.js
// Load GA
(function(G,o,O,g,l){
// Mock function
G.GoogleAnalyticsObject=O;
G[O]||(G[O]=function(){
(G[O].q=G[O].q||[]).push(arguments)
});
G[O].l=+new Date;
// Async load library
View test.py
import graphene
from graphene import relay
USER_DATA = [
{
'user_id': '1',
'first_name': 'Peter',
'last_name': 'Cabbage',
'email_address': 'peter@cabbage.com',
'age': 32
View cfg
// Rates
rate "128000"
cl_cmdrate "128"
cl_updaterate "128"
cl_interp "0.0"
cl_interp_ratio "1"
cl_lagcompensation "1"
// Mouse
sensitivity "2"
@ptz0n
ptz0n / hawttrends.sh
Last active Aug 29, 2015
Hot Google Searches Searches in Sweden
View hawttrends.sh
curl http://hawttrends.appspot.com/api/terms/ | jq '.["42"]'
@ptz0n
ptz0n / ga-check.js
Last active Jul 1, 2018
Google Analytics - Universal or Legacy?
View ga-check.js
/**
* Check whether we have the legacy or universal lib available
*
* https://developers.google.com/analytics/devguides/collection/upgrade/reference/gajs-analyticsjs
*
*/
if(typeof _gaq !== 'undefined') {
console.log('ga.js'); // or via GTM?
}
else if(typeof ga !== 'undefined') {
@ptz0n
ptz0n / output
Last active Dec 19, 2015
ultrahook debugging
View output
/Library/Ruby/Gems/1.8/gems/ultrahook-0.1.1/lib/ultrahook/client.rb:37:in `start': undefined method `home' for Dir:Class (NoMethodError)
from /Library/Ruby/Gems/1.8/gems/ultrahook-0.1.1/bin/ultrahook:6
from /usr/bin/ultrahook:23:in `load'
from /usr/bin/ultrahook:23