Skip to content

Instantly share code, notes, and snippets.

/*
* A simple on-demand based mmap alloc-only proof-of-concept to just check out the possibilities of having a
* single giant MAP_FIXED allocation for a process that may not need to call free at all and just work with a
* contiguous allocation space
*
* A mmap contiguous hole space is reserved with a PROT_READ and then individual pages overridden with
* PROT_WRITE on page faults in sigsegv handler which mmaps the faulting address space.
*
* As a test, a 1 GIG file is created and then read into the memory allocated from the contiguous vma which is a
* brain-dead linear allocator from the address space as there are no requirements to free memory here.
@diclophis
diclophis / pairs.rb
Last active January 4, 2016 05:19
node graph chain detector thingy
class EdgeEmitter
include Enumerable
attr_accessor :edges
def initialize(filename)
# you should load the file and save the edges
end
# implementation of Enumerable is bonus points
def length
<!DOCTYPE html>
<html>
<head>
<title>Mavenlink is unavailable due to scheduled maintenance. Mavenlink will return shortly.</title>
<style type="text/css">
html, body {
width: 100%; height: 100%;
margin: 0; padding: 0;
overflow: hidden;
#!/bin/sh
in=$1
out=$2
curl -s \
-d compilation_level=SIMPLE_OPTIMIZATIONS \
-d output_format=text \
-d output_info=compiled_code \
--data-urlencode "js_code@${in}" \
@diclophis
diclophis / gist:2655742
Created May 10, 2012 20:39
Tizen ADB/SDB shell for developer reference hardware (larkspur)
ADB_TRACE=1 ./platform-tools/adb connect 192.168.129.2:20434
system/core/adb/adb.c::main():Handling commandline()
system/core/adb/adb_client.c::adb_query():adb_query: host:connect:192.168.129.2:20434
system/core/adb/adb_client.c::_adb_connect():_adb_connect: host:version
system/core/adb/transport.c::writex():writex: fd=3 len=4: 30303063 000c
system/core/adb/transport.c::writex():writex: fd=3 len=12: 686f73743a76657273696f6e host:version
system/core/adb/transport.c::readx():readx: fd=3 wanted=4
system/core/adb/transport.c::readx():readx: fd=3 wanted=4 got=4
4f4b4159 OKAY
system/core/adb/adb_client.c::_adb_connect():_adb_connect: return fd 3
// setup a small scratch buffer
short *buffer;
buffer = new short[min_buffer_length];
void *pump_audio(void *) {
int wrote;
// zero out the scratch buffer
memset(buffer, 0, min_buffer_length * sizeof(short));
** [out :: ofsocket-backend3.c43893.blueboxgrid.com] PING ofsocket-interconnect.openfeint.com (67.214.208.204) 56(84) bytes of data.
** [out :: ofsocket02-prod.of.c43893.blueboxgrid.com] 64 bytes from shopwgby.org (67.214.208.204): icmp_seq=1 ttl=253 time=0.850 ms
@diclophis
diclophis / gist:937203
Created April 22, 2011 17:45
nginx access log mystery entries
::ffff:201.144.87.36 - - [22/Apr/2011:10:43:22 -0700] "-" 408 0 "-" "-"
::ffff:61.158.152.198 - - [22/Apr/2011:10:43:22 -0700] "-" 400 0 "-" "-"
::ffff:178.106.234.56 - - [22/Apr/2011:10:43:22 -0700] "-" 408 0 "-" "-"
::ffff:123.122.8.124 - - [22/Apr/2011:10:43:22 -0700] "-" 400 0 "-" "-"
::ffff:95.220.254.247 - - [22/Apr/2011:10:43:23 -0700] "-" 400 0 "-" "-"
/opt/nginx/sbin/nginx -V
nginx: nginx version: nginx/0.9.3
nginx: built by gcc 4.1.2 20080704 (Red Hat 4.1.2-48)
nginx: TLS SNI support disabled
nginx: configure arguments: --prefix=/opt/nginx --with-http_ssl_module --add-module=/usr/local/rvm/gems/ree-1.8.7-2010.02/gems/passenger-3.0.1/ext/nginx --with-http_ssl_module --with-ipv6 --with-http_stub_status_module
Processing InternalController#revision (for localhost at 2010-04-27 16:27:26) [GET]
Parameters: {"wang"=>"wang"}
Completed in 12ms (View: 1, DB: 2) | 200 OK [http://localhost/internal/revision?wang=%22wang%22]