Skip to content

Instantly share code, notes, and snippets.

View alevy's full-sized avatar

Amit Levy alevy

View GitHub Profile
@alevy
alevy / main.rs
Last active May 30, 2017 13:32
nrf-test take 2
#![feature(asm, lang_items, naked_functions)]
#![no_std]
#![no_main]
#[lang = "panic_fmt"]
#[no_mangle]
fn rust_begin_panic(_msg: core::fmt::Arguments, _file: &'static str, _line: u32) -> ! {
loop {}
}

Keybase proof

I hereby claim:

  • I am alevy on github.
  • I am amit (https://keybase.io/amit) on keybase.
  • I have a public key whose fingerprint is 5F32 9878 D080 3479 F0F6 162A A60A BEE4 AD8E C024

To claim this, I am signing this object:

@alevy
alevy / .gdbinit
Created August 17, 2016 13:05
Tock GDB
target remote :2331
file build/storm/kernel.elf
monitor reset

Keybase proof

I hereby claim:

  • I am alevy on github.
  • I am amit (https://keybase.io/amit) on keybase.
  • I have a public key ASD5IHMKpuZHvYE139uGlTYq52l0le2uA2jkXefh8ynbwgo

To claim this, I am signing this object:

@alevy
alevy / _intro.md
Last active August 29, 2015 14:25
Syscall/Driver interface

Interface for/to Drivers

Drivers implement the Driver trait --- command and subscribe methods that correspond to command and subscribe system calls for that driver.

The subscribe system call comes with access to a Callback. Callbacks encode the process that invoked the syscall, and the function pointer passed as a callback. Callbacks also act as a capability to allocate memory from the application's heap space.

Questions

@alevy
alevy / pomodoro
Created March 23, 2015 21:28
Pomodoro for xmobar with libnotify notifications
#!/bin/bash
pomodoro_file=$HOME/.pomodoro
default_pomodoro_time=1500
pomodoro_time=$default_pomodoro_time
default_rest_time=300
rest_time=$default_rest_time
notify_cmd="notify-send --icon=$HOME/local/share/icons/pomodoro.png Pomodoro"
@alevy
alevy / test.js
Created December 3, 2014 01:34
MemJS load test
var cp = require('child_process');
var children = [];
for (var i = 0; i < 500; i += 1) {
children.push(cp.fork(__dirname + '/test_child.js'));
}
setTimeout(function() {
for (var i = 0; i < children.length; i += 1) {
@alevy
alevy / server_net.go
Created April 13, 2014 23:40
Golang tls.Conn#Read vs net.Conn#Read discrepency
package main
import (
"net"
"log"
)
func main() {
listener, err := net.Listen("tcp", ":8080")
if err != nil {

Keybase proof

I hereby claim:

  • I am alevy on github.
  • I am amit (https://keybase.io/amit) on keybase.
  • I have the public key with fingerprint 720B 97A3 E367 ACC3 45FC  A0FB 68CA AE74 BF7C 250A

To claim this, I am signing this object:

@alevy
alevy / gist:5512907
Created May 3, 2013 19:05
Dalli store/get large value
require 'dalli'
module Dalli
class Client
def set_large(key, val, ttl = 0)
chunk_size = 1024 * 900
i = 0
start_idx = 0
next_chunk = val[start_idx..(start_idx + chunk_size - 1)]
start_idx += chunk_size