Skip to content

Instantly share code, notes, and snippets.

@cirias
cirias / two-prisoners-count-trees.js
Last active May 8, 2016 03:21
two-prisoners-count-trees
var options = {
smaller: 18,
bigger: 20,
};
var northInferSouthMin;
var southInferNorthMax;
function northAnswer (trees) {
northInferSouthMin = options.bigger - southInferNorthMax;
// console.log(' northInferSouthMin', northInferSouthMin);
#include "PinChangeInterrupt.h"
// Choose a valid PinChangeInterrupt pin of your Arduino board
#define pcintThrottle 12 // A4
#define pcintAileron 13 // A5
void rising1(void);
void falling1(void);
void rising2(void);
@cirias
cirias / a.ino
Last active August 8, 2016 11:19
#include "PinChangeInterrupt.h"
// Choose a valid PinChangeInterrupt pin of your Arduino board
#define pcintThrottle 12 // A4
#define pcintAileron 13 // A5
/* #define pcintThrottle 13 // A4 */
volatile int thro_pwm_value = 0;
volatile int thro_prev_time = 0;
volatile int aile_pwm_value = 0;
@cirias
cirias / watch.sh
Created December 14, 2017 07:47
watch and execute
#!/bin/bash
# monitor STDIN
# run command when interval of lines come in smaller than sepecific duration
DURATION=2 # in seconds
LINES_COUNT=1
COMMAND="echo Aha!"
SECONDS=$DURATION
@cirias
cirias / game.txt
Last active December 15, 2017 03:40
life
x
x x
xx xx xx
x x xx xx
xx x x xx
xx x x xx x x
x x x
x x
xx
package hanabi
import (
"math/rand"
"time"
)
const (
white = iota
yellow
<div id="main">
<div id="window">
<div class="parent"></div>
</div>
</div>
<style>
div#main {
width: 100%;
}
@cirias
cirias / setup.sh
Last active April 2, 2018 08:58
SSH using GPG on Ubuntu 17.10
cat > ~/.gnupg/gpg-agent.conf <<EOF
default-cache-ttl 600
max-cache-ttl 7200
enable-ssh-support
EOF
gpgconf --kill gpg-agent
gpg-connect-agent reloadagent /bye
# man gpg-agent
@cirias
cirias / decode.go
Created April 18, 2018 07:16
Golang decode 7bit text
package main
import (
"encoding/hex"
"fmt"
)
func main() {
const sample = "54747A0E4ACF4161D00D244ED341F4329E1E02"