Skip to content

Instantly share code, notes, and snippets.

View muhamadazmy's full-sized avatar

Muhamad Awad muhamadazmy

View GitHub Profile
@muhamadazmy
muhamadazmy / msgpack-go-rust-compatibility.md
Created August 7, 2019 13:04
Test msgpack compatibility accross go and rust.

Quick test for msgpack compatibility

The code below (data encoded in Go) and then decoded in Rust. works fine.

Rust decoder

extern crate rmp_serde as rmps;
extern crate serde;

#[macro_use]
extern crate serde_derive;
@muhamadazmy
muhamadazmy / borrow.rs
Last active March 5, 2019 09:37
No idea why this doesn't build
struct Cache {}
impl Cache {
fn new() -> Cache {
Cache {}
}
fn get(&mut self, key: &u32) -> Option<&str> {
None
}
#SET TO DESTINATION IP
DEST_IP='172.17.0.1'
#CHANGE IF NECESSARY (the dest ip should be reachable from eth0)
DEV=eth0
dmesg -n 7
modprobe configfs
@muhamadazmy
muhamadazmy / copy-chroot.sh
Created December 19, 2017 13:19
Copy binaries to a chroot
#!/bin/bash
if [ $# != 2 ] ; then
echo "usage $0 PATH_TO_BINARY TARGET_FOLDER"
exit 1
fi
PATH_TO_BINARY="$1"
TARGET_FOLDER="$2"
@muhamadazmy
muhamadazmy / ubuntu-flist.sh
Last active February 24, 2019 08:50
A build script for ubuntu flist (type ./ubuntu-flist.sh -h for options)
#!/bin/bash
set -e
function error {
echo -e $* >&2
}
OPTS=`getopt -o hd:p: -l help,dist:,password:,jwt: -- "$@"`
if [ $? != 0 ] ; then error "Failed parsing options." ; exit 1 ; fi
@muhamadazmy
muhamadazmy / ledisbug.go
Created August 13, 2017 08:37
Reproduce the ledis bug
package main
import (
"fmt"
"github.com/siddontang/ledisdb/config"
"github.com/siddontang/ledisdb/server"
"gopkg.in/redis.v2"
"math/rand"
"time"
)
@muhamadazmy
muhamadazmy / influxdb.query
Created July 17, 2017 13:03
Influxdb Difference between 2 series values
select mean("x") - mean("y") FROM
(SELECT mean("value") as "x" FROM "series" WHERE $timeFilter GROUP BY time($__interval)),
(SELECT mean("value") as "y" FROM "series" WHERE $timeFilter GROUP BY time($__interval))
WHERE $timeFilter group by time($__interval) fill(linear)
from i3pystatus import Status
from i3pystatus.weather import Weather
status = Status()
# Displays clock like this:
# Tue 30 Jul 11:59:46 PM KW31
# ^-- calendar week
status.register("clock",
format="%a %-d %b %X",)
# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout somewhen, delete
# this file and re-run i3-config-wizard(1).
#
# i3 config file (v4)
#
# Please see http://i3wm.org/docs/userguide.html for a complete reference!
# vim: filetype=yaml
---
meta:
description: 'Solarized theme by lasers'
colors:
base03: '#002b36'
base02: '#073642'
base01: '#586e75'
base00: '#657b83'
base0: '#839496'