Skip to content

Instantly share code, notes, and snippets.

Stig Lindqvist stojg

View GitHub Profile
stojg / slowpoke.go
Created Dec 16, 2017
go program to run after a slow process, which sends you a text so that you know when it's finished
View slowpoke.go
// This golang program is a remix/parody of
// that notifies the user that notifies a user after a slow process have finished, but instead of using the computers
// speech synthesiser or notification system, sends you a text instead. This means that you can leave the safe confines
// of your desk while scavenging office supplies, stalk colleagues or have a quiet smoko. I.e. it's the 2020 version of
// Ideal for those dependency fetching / compiling steps.
// To make this work you need to at least setup a `` trial account and define a couple ENV
// variables:
// # Get this from your twilio account
stojg / Features.php
Created Apr 5, 2017
Playing around with features
View Features.php
// could be abstract class?
interface FeatureInterface {
function isSupported();
interface LetmeinInterface extends FeatureInterface {
function letmein($username, $password);
stojg /
Last active Oct 4, 2016 — forked from codepunkt/
find/delete corrupt whisper-files
options=('find' 'delete')
PS3='state your wish: '
echo -e "\nfind/delete corrupt whisper-files"
select opt in "${options[@]}"; do
case $REPLY in
[12] ) option=$opt; break;;
* ) exit;;
stojg / mini_statemachine.js
Last active Oct 10, 2016
a mini example on how to implement a state machine for transitioning between states, like a user flow
View mini_statemachine.js
// these are generic functions that return boolean depending of the state in data
// they are used by state transitions to progress the state machine
const hasStarted = (data) => data.started === true;
const isEmployee = (data) => data.employee === true;
const isPersonal = (data) => data.personal === true;
// this is where we set up the full statemachine and connect 'from' states (e.g "initState") and where
// they can transition to (e.g. "setTypeState") and what would trigger that transition
const transitions = {
// initial state
View anonymiser.go
package main
import (
View hello
stojg / sleep_server.go
Created Mar 16, 2016
Sleep server, connects, but takes ages to respond
View sleep_server.go
package main
stojg / sleep.ino
Last active Apr 12, 2019
Arduino sleep example
View sleep.ino
#include "Arduino.h"
#include <avr/sleep.h>
#include <avr/power.h>
#include <avr/wdt.h>
// Blink Before sleeping
#define LED_PIN (13)
// This variable is made volatile because it is changed inside
// an interrupt function
stojg /
Created Feb 3, 2016
delete corrupted graphite whisper files
options=('find' 'delete')
PS3='state your wish: '
echo -e "\nfind/delete corrupt whisper-files"
select opt in "${options[@]}"; do
case $REPLY in
[12] ) option=$opt; break;;
* ) exit;;
stojg / curl.php
Last active Aug 29, 2015
simple curl template
View curl.php
function get($url) {
$timeout = 2;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$result = curl_exec($ch);
You can’t perform that action at this time.