Look at LSB init scripts for more information.
Copy to /etc/init.d
:
# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
STDOUT.sync = true | |
require 'queue' | |
start_time = Time.now.to_i | |
msg = 0 | |
queue = Queue.new("testing") | |
queue.subscribe do |obj| | |
msg += 1 |
%%% File : ahocorasik.erl | |
%%% Author : Fyodor Ustinov <ufm@ufm.su> | |
%%% Descrip.: Multiple search based on Aho-Corasick string matching algorithm | |
%%% | |
%%% License : GPL | |
%%% | |
%%% Usage: | |
%%% ahocorasik:match(["pat1", "pat2"], "pat1 pat2 pat1") | |
%%% or | |
%%% Tree = ahocorasik:tree(["pat1", "pat2"]) |
# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com | |
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below) | |
module Player | |
describe MovieList, "with optional description" do | |
it "is pending example, so that you can write ones quickly" | |
it "is already working example that we want to suspend from failing temporarily" do | |
pending("working on another feature that temporarily breaks this one") |
#!/usr/bin/env ruby | |
require 'base64' | |
require 'digest' | |
# get 16 random hex bytes | |
# | |
def new_salt | |
16.times.inject('') {|t| t << rand(16).to_s(16)} | |
end |
#!/usr/bin/env python | |
""" | |
Very simple HTTP server in python (Updated for Python 3.7) | |
Usage: | |
./dummy-web-server.py -h | |
./dummy-web-server.py -l localhost -p 8000 | |
Send a GET request: |
object HexBytesUtil { | |
def hex2bytes(hex: String): Array[Byte] = { | |
hex.replaceAll("[^0-9A-Fa-f]", "").sliding(2, 2).toArray.map(Integer.parseInt(_, 16).toByte) | |
} | |
def bytes2hex(bytes: Array[Byte], sep: Option[String] = None): String = { | |
sep match { | |
case None => bytes.map("%02x".format(_)).mkString | |
case _ => bytes.map("%02x".format(_)).mkString(sep.get) |
Look at LSB init scripts for more information.
Copy to /etc/init.d
:
# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
// create an new instance of a pixi stage | |
var stage = new PIXI.Stage(0x66FF99); | |
// create a renderer instance | |
var renderer = PIXI.autoDetectRenderer(400, 300); | |
// create a manager instance, passing stage and renderer.view | |
var manager = new PIXI.InteractionManager(stage, renderer.view); | |
stage | |
.on('click', function (event) { | |
console.log(event.type, event.target); // 'click', PIXI.DisplayObject {} |
TADA, it’s `hexdump -v -e '64/1 "%02x" "\n"' < /dev/hidraw3` | |
No idea what the first byte is… but I’m going to assume its for device ID for the many users that are connected, but it probably has to be set by the connected machine? | |
01ff777f7f0800aa0000435dfdf1ff14000200c5ff0721150300000000001b000001fc9133a32990880428008000000080000000008000000080000000008000 | |
↑↑↑↑ | |
left stick, value, first field is horz (00 left), second field is vertical (00 top) | |
017f80ff61080064000059f2fdfffffbff0e00d107081e9bf600000000001b0000018e94b1b00690880428008000000080000000008000000080000000008000 | |
↑↑↑↑ |
import java.io._ | |
import java.util.zip._ | |
val pi = new PipedInputStream | |
val po = new PipedOutputStream(pi) | |
val zo = new GZIPOutputStream(po) | |
val zi = new GZIPInputStream(pi) | |
val w = new PrintWriter(zo) | |
val r = new BufferedReader(new InputStreamReader(zi)) |