Skip to content

Instantly share code, notes, and snippets.

View Gnitset's full-sized avatar

Klas Meder Gnitset

  • Nordnet Bank AB
  • Stockholm, Sweden
  • 01:21 (UTC +02:00)
View GitHub Profile
### Keybase proof
I hereby claim:
* I am gnitset on github.
* I am gnitset (https://keybase.io/gnitset) on keybase.
* I have a public key ASBqBzEX36RNCn2qfsepEjMMh35M431KkdnvlXeY-akKHwo
To claim this, I am signing this object:
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include <IRremoteESP8266.h>
#include <IRsend.h>
const char* ssid = "XXXXX";
const char* password = "XXXXX";
const char* www_username = "admin";
const char* www_password = "esp8266";
import machine
rmt = machine.RMT(channel=4, gpio="P12", tx_idle_level=machine.RMT.LOW, tx_carrier=(38000, 50, machine.RMT.HIGH))
# channel 4 ahs a resolution of 1000ns = 1us
header = (2220,784)
one = (758,1568)
zero = (758,804)
ptrail = (761,30000)
pre_data = 0x48
pre_data_bits = 7
# Event handler
using terms from application "Messages"
on message received theText from theBuddy for theChat
set quoted_message to quoted form of theText
set quoted_id to quoted form of (id of theBuddy as text)
do shell script "echo " & quoted_message & " | ~/bin/MessageReceive.sh " & quoted_id & " > /dev/null 2>&1 &"
# make messages happy
return true
end message received
@Gnitset
Gnitset / te.c
Last active December 16, 2015 22:49
/*
* -----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <gnitset@servern.info> wrote this file. As long as you retain this notice you
* can do whatever you want with this stuff. If we meet some day, and you think
* this stuff is worth it, you can buy me a beer in return - Klas Meder Boqvist
* -----------------------------------------------------------------------------
*/
#include <sys/time.h>
def is_sorted(a):
for (c,d) in enumerate(a):
if c!=d:
return False
return True
def shuffle(a):
a_len=len(a)
map(a.extend,zip(a[:a_len/2],a[a_len/2:a_len]))
del a[:a_len]
def is_sorted(a):
for (c,d) in enumerate(a):
if c!=d:
return False
return True
def shuffle(a):
a_len=len(a)
map(a.extend,zip(a[:a_len/2],a[a_len/2:a_len]))
del a[:a_len]