Skip to content

Instantly share code, notes, and snippets.

#![feature(globs)]
extern crate mio;
use mio::*;
use mio::net::*;
use mio::net::tcp::*;
const SERVER: Token = Token(0);
struct Server {
@ayosec
ayosec / jobs.rs
Last active June 6, 2016 19:23
Rust: dispatch jobs in tasks
extern crate time;
use std::io::timer::sleep;
use std::sync::deque::{BufferPool, Empty, Abort, Data};
use std::time::Duration;
fn main() {
let start = time::precise_time_s();
let pool = BufferPool::new();
@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();
@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 / 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 / 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);
}
8.2.3. HTTP log format
----------------------
The HTTP format is the most complete and the best suited for HTTP proxies. It
is enabled by when "option httplog" is specified in the frontend. It provides
the same level of information as the TCP format with additional features which
are specific to the HTTP protocol. Just like the TCP format, the log is usually
emitted at the end of the session, unless "option logasap" is specified, which
generally only makes sense for download sites. A session which matches the
"monitor" rules will never logged. It is also possible not to log sessions for
@ayosec
ayosec / LoggerServer.scala
Created November 19, 2013 08:27
Simple logger server for logback
import java.net.ServerSocket
import java.io.ObjectInputStream
import java.io.BufferedInputStream
import ch.qos.logback.classic.spi.ILoggingEvent
object LoggerServer extends App {
val server = new ServerSocket(4004)
println("Socket bound")
@ayosec
ayosec / Dockerfile
Created November 18, 2013 19:17
Docker on Jenkins
FROM ubuntu:latest
MAINTAINER GrapheneDB Ops Team [email protected]
RUN mkdir -p /var/run/sshd
RUN mkdir -p /var/log/supervisor/
RUN useradd -d /var/jenkins -m jenkins
RUN mkdir -p /root/.ssh && chmod 700 /root/.ssh
RUN echo deb http://archive.ubuntu.com/ubuntu precise universe >> /etc/apt/sources.list.d/universe.list
RUN apt-get update
RUN apt-get install -q -y openjdk-7-jre-headless supervisor openssh-server
@ayosec
ayosec / example.html
Created November 6, 2013 14:36
Example with closest
<div id="node0">
<a href="#" id="node1">
<b id="node2">This is bold</b>
This is regular text
</a>
</div>
<script>