Skip to content

Instantly share code, notes, and snippets.

View stelcheck's full-sized avatar

Marc Trudel stelcheck

View GitHub Profile
defmodule Conversation do
use GenFSM
def start_link() do
IO.puts "Starting FSM"
GenFSM.start_link(__MODULE__, nil)
end
def hello(pid) do
GenFSM.send_event(pid, :hello)
@stelcheck
stelcheck / example.js
Last active September 7, 2016 11:34
CIDR from netmask
function hammingWeight(i) {
i = i - ((i >> 1) & 0x55555555);
i = (i & 0x33333333) + ((i >> 2) & 0x33333333);
return ((i + (i >> 4) & 0xF0F0F0F) * 0x1010101) >> 24;
}
function netmaskToCIDR(netmask) {
let chunks = netmask.split('.')
if (chunks.length != 4) {
return false;
@stelcheck
stelcheck / 01-runner.js
Last active April 18, 2021 03:54
REPL example for electron
'use strict'
const net = require('net')
const chalk = require('chalk')
const path = require('path')
const cp = require('child_process')
const rimraf = require('rimraf')
function getPath() {
var mySecret = "All your base";
var found = false;
while (!found) {
var b = new Buffer(1000);
var str = b.toString('utf8')
if (str.indexOf(mySecret) > -1) {
found = true;
console.log('Found:', str);
}
var ByteBuffer = require('bytebuffer');
var flatbuffers = require('./flatbuffers').flatbuffers;
var schema = require('./schema_generated.js').MyGame;
var count = 100000;
var builder = new flatbuffers.Builder();
var name = builder.createString('Holtzinger');
schema.Monster.startMonster(builder);
schema.Monster.addPos(builder, schema.Vec3.createVec3(builder, 1, 2, 3))
@stelcheck
stelcheck / .bash_profile
Last active August 29, 2015 14:15
Tweet updates in your terminal
TWEET_FEED="/tmp/tweets"
TWEET_FEED_PIDFILE="/tmp/tweets.pid"
checkTweetsFetcher () {
TWEET_FEED_PID="$(cat ${TWEET_FEED_PIDFILE} 2> /dev/null)"
if
! kill -0 "${TWEET_FEED_PID}" 2> /dev/null
then
echo -n "Starting tweet feed check... " | green | bold
@stelcheck
stelcheck / keybase.md
Created September 23, 2014 07:21
keybase.md

Keybase proof

I hereby claim:

  • I am stelcheck on github.
  • I am stelcheck (https://keybase.io/stelcheck) on keybase.
  • I have a public key whose fingerprint is 3F52 E937 81F2 D063 98A7 4B81 CDDD DB5F 58B9 642D

To claim this, I am signing this object:

@stelcheck
stelcheck / compile.sh
Last active August 29, 2015 14:04
MAGE test
g++ -g -Wall -std=c++0x -DHTTP_CONNECTOR -I ./src -I ./vendor/libjson-rpc-cpp/src -L ./vendor/libjson-rpc-cpp/build/out -L ./build -ljsonrpc -lmage -ldl /usr/lib/libcurl.dylib examples/test.cpp -o examples/test
testing gist cli
@stelcheck
stelcheck / first
Last active August 29, 2015 13:56
npm publish fail
mt@kodachi:~/node-graylog2 (node-graylog2.git::master)$ npm publish
Now using NPM under Node.js v0.6.11
npm http PUT https://registry.npmjs.org/graylog2
npm http 201 https://registry.npmjs.org/graylog2
npm http GET https://registry.npmjs.org/graylog2
npm http 200 https://registry.npmjs.org/graylog2
npm http PUT https://registry.npmjs.org/graylog2/0.1.2/-tag/latest
npm http 201 https://registry.npmjs.org/graylog2/0.1.2/-tag/latest
npm http GET https://registry.npmjs.org/graylog2
npm http 200 https://registry.npmjs.org/graylog2