Skip to content

Instantly share code, notes, and snippets.

@ayosec
ayosec / README.md
Last active August 29, 2015 13:56
Sweet.js: Better for

Add for(value <- items) and for(value, offset <- items) to Sweet.js

Examples

for(x <- [1,2,3,4]) {
  var a = x + 10;
  print(a);
}
@ayosec
ayosec / Makefile
Last active August 29, 2015 13:57 — forked from Judit/application.coffee
application.js: application.coffee
coffee -c application.coffee
server: application.js
python -m SimpleHTTPServer 5050
.PHONY: server
@ayosec
ayosec / openssl-des3-test.sh
Last active August 29, 2015 14:00
OpenSSL: DES3 to encrypt/decrypt with passwords
mkdir -p /tmp/openssl-test
cd /tmp/openssl-test
date > test_file
openssl des3 -e -salt -in test_file -out test_file.des3 -k foo.bar.1
echo test_file.des3:
hexdump -C test_file.des3
@ayosec
ayosec / a.rs
Last active August 29, 2015 14:06
Rust mpmc_bounded_queue::Queue
use std::sync::mpmc_bounded_queue::Queue;
use std::io::Timer;
use std::time::Duration;
fn main() {
let queue: Queue<i8> = Queue::with_capacity(10);
queue.push(0);
let q1 = queue.clone();
#![feature(globs)]
extern crate mio;
use mio::*;
use mio::net::*;
use mio::net::tcp::*;
const SERVER: Token = Token(0);
struct Server {
@ayosec
ayosec / xorshf.rs
Last active August 29, 2015 14:10
Rust implemenation for Xorshift*
extern crate time;
#[deriving(Show)]
struct XorshiftStar {
x: u64
}
impl XorshiftStar {
fn new() -> XorshiftStar {
XorshiftStar { x: time::now().tm_nsec as u64 }
use std::collections::HashMap;
use std::collections::hash_map::Entry;
fn main() {
let text = [
"The", "quick", "brown", "fox", "jumped", "over", "the", "lazy", "dog",
"at", "a", "restaurant", "near", "the", "lake", "of", "a", "new", "era"
];
let mut map: HashMap<&str, u32> = HashMap::new();
@ayosec
ayosec / extract-fragments-ffmpeg.rb
Created December 22, 2014 00:22
Extract fragments from a video using FFmpeg
#!/usr/bin/ruby
require "tmpdir"
def usage()
STDERR.puts <<EOU
Usage: #$0 input-file output-file ranges+
Ranges can be defined with:
@ayosec
ayosec / tools.md
Last active August 29, 2015 14:14 — forked from nrc/tools.md

Rust developer tools - status and strategy

Availability and quality of developer tools are an important factor in the success of a programming language. C/C++ has remained dominant in the systems space in part because of the huge number of tools tailored to these lanaguages. Succesful modern languages have had excellent tool support (Java in particular, Scala, Javascript, etc.). Finally, LLVM has been successful in part because it is much easier to extend than GCC. So far, Rust has done pretty well with developer tools, we have a compiler which produces good quality code in reasonable time, good support for debug symbols which lets us leverage C++/lanaguge agnostic tools such as debuggers, profilers, etc., there are also syntax highlighting, cross-reference, code completion, and documentation tools.

In this document I want to layout what Rust tools exist and where to find them, highlight opportunities for tool developement in the short and long term, and start a discussion about where to focus our time an

@ayosec
ayosec / spray-json-requests
Created January 29, 2015 03:01
Spray JSON requests
scala> :paste
// Entering paste mode (ctrl-D to finish)
import play.api.libs.json._
import spray.http._
import MediaTypes._
import spray.client.pipelining.Post
import spray.httpx.marshalling.Marshaller
case class Foo(a: Int, b: String)