Skip to content

Instantly share code, notes, and snippets.

/**
* DotBlock Mobile
*
* @package DotBlock
* @author Joshua Priddle <jpriddle@nevercraft.net>
* @copyright Copyright (c) 2011, DotBlock, Inc
* @version 1.0
* @url http://www.dotblock.com/
*/
/**
* DotBlock Mobile
*
* @package DotBlock
* @author Joshua Priddle <jpriddle@nevercraft.net>
* @copyright Copyright (c) 2011, DotBlock, Inc
* @version 1.0
* @url http://www.dotblock.com/
*/
var $CONFIG = function(key, value) {
if (arguments.length == 2) {
if (value === null) {
Ti.App.Properties.removeProperty(key);
} else {
Ti.App.Properties.setString(key, JSON.stringify(value));
}
} else if (arguments.length == 1) {
var data = Ti.App.Properties.getString(key, false);
return data && JSON.parse(data) || undefined;
#
# Titanium Mobile Rake tasks
#
# Validate and launch your Titanium Mobile application via Rake
#
# Edit Application::COMPILER if not using OS X
# Requires jsl (install on OS X via homebrew with `brew install jsl`)
#
# Only supports iPhone right now.
#

If you would like to get involved, http://www.restorethefourth.net/ is the starting point.

Reasons I, personally, am joining this movement:

Guantanamo (though undoubtedly many dangerous people are there, it is a clear violation of human rights to hold people without trial, and not all held are guilty)

Extraordinary Rendition (the habit of sending people to politically allied states for the purpose of torture, since we "don't do that" here)

No-fly lists (not subject to review, based on low evidence, with many false-positive examples)

#cribbed from http://vimeo.com/52569901 (Twilio carrier call origination moderation)
# The idea is that many fan-in queues can enqueue at any rate, but
# dequeue needs to happen in a rate-controlled manner without allowing
# any individual input queue to starve other queues.
# http://en.wikipedia.org/wiki/Leaky_bucket (second sense, "This version is referred to here as the leaky bucket as a queue.")
#
# requires:
# redis 2.6+
# redis-py>=2.7.0
# anyjson
use std::net::UdpSocket;
use std::env;
//use std::io::BufReader;
use std::fmt;
use std::default::Default;
fn get_octet(buf: &[u8]) -> u16 {
let mut res: u16;
res = match (buf[0] as char).to_digit(16) {
@marchon
marchon / dns_packet.rs
Created July 30, 2017 20:04 — forked from cyberDrake/dns_packet.rs
playing around with a DNS packet definition for libpnet
//! DNS packet abstraction
use packet::Packet;
use pnet_macros::types::*;
/// Represents an UDP Packet
#[packet]
pub struct Dns {
id: u16be,
@marchon
marchon / ecdsa_demo.py
Created January 20, 2018 19:15 — forked from nlitsme/ecdsa_demo.py
python implementation of ecdsa calculations, demonstrating how to recover a private key from two signatures with identical 'r', and demonstrating how to find the public key from a signature and message, or from two signatures.
"""
By Willem Hengeveld <itsme@xs4all.nl>
ecdsa implementation in python
demonstrating several 'unconventional' calculations,
like finding a public key from a signature,
and finding a private key from 2 signatures with identical 'r'
"""
# (gcd,c,d)= GCD(a, b) ===> a*c+b*d!=gcd:
@marchon
marchon / EventMachines.md
Created March 17, 2018 03:50 — forked from eulerfx/EventMachines.md
The relationship between state machines and event sourcing

A state machine is defined as follows:

  • Input - a set of inputs
  • Output - a set of outputs
  • State - a set of states
  • S0 ∈ S - an initial state
  • T : Input * State -> Output * State - a transition function

If you model your services (aggregates, projections, process managers, sagas, whatever) as state machines, one issue to address is management of State. There must be a mechanism to provide State to the state machine, and to persist resulting State for subsequent retrieval. One way to address this is by storing State is a key-value store. Another way is to use a SQL database. Yet another way is event sourcing. The benefit of even sourcing is that you never need to store State itself. Instead, you rely on the Output of a service to reconstitute state. In order to do that, the state machine transition function needs to be factored into two functions as follows: