Skip to content

Instantly share code, notes, and snippets.

View chaicko's full-sized avatar

Alejandro Schwoykoski chaicko

View GitHub Profile
"""
HexByteConversion
Convert a byte string to it's hex representation for output or visa versa.
ByteToHex converts byte string "\xFF\xFE\x00\x01" to the string "FF FE 00 01"
HexToByte converts string "FF FE 00 01" to the byte string "\xFF\xFE\x00\x01"
"""
#-------------------------------------------------------------------------------
@chaicko
chaicko / gist:c659fb8b50985880e1eb
Last active August 29, 2015 14:27
Emulating ARM on Debian/Ubuntu

You might want to read this to get an introduction to armel vs armhf.

If the below is too much, you can try Ubuntu-ARMv7-Qemu but note it contains non-free blobs.

Running ARM programs under linux (without starting QEMU VM!)

First, cross-compile user programs with GCC-ARM toolchain. Then install qemu-arm-static so that you can run ARM executables directly on linux

#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/mman.h>
#define FILEPATH "/tmp/mmapped.bin"
#define NUMINTS (1000)
#!/usr/bin/env bash
cd $HOME
git clone git://git.linaro.org/qemu/qemu-linaro.git qemu-linaro
cd qemu-linaro
sudo apt-get build-dep qemu # to install the build dependencies of qemu
./configure --target-list=arm-softmmu --prefix=$HOME/qemu
make
make install
# Now you have a QEMU in $HOME/qemu/bin/qemu-system-arm and can test a BeagleBoard-xM build on qemu by running:
@chaicko
chaicko / tmux-cheatsheet.markdown
Created March 4, 2016 12:41 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@chaicko
chaicko / disallow-new.js
Created April 15, 2016 14:59 — forked from mattdesl/disallow-new.js
avoiding new in classes
// Allows:
// funkyParser()
module.exports = function createFunkyParser(opt) {
return new FunkyParser(opt)
}
function FunkyParser(opt) {
// make params optional
opt = opt || {}
#! /usr/bin/awk -f
# A script to extract the actual suppression info from the output of (for example) valgrind --leak-check=full --show-reachable=yes --error-limit=no --gen-suppressions=all ./minimal
# The desired bits are between ^{ and ^} (including the braces themselves).
# The combined output should either be appended to /usr/lib/valgrind/default.supp, or placed in a .supp of its own
# If the latter, either tell valgrind about it each time with --suppressions=<filename>, or add that line to ~/.valgrindrc
# NB This script uses the |& operator, which I believe is gawk-specific. In case of failure, check that you're using gawk rather than some other awk
# The script looks for suppressions. When it finds one it stores it temporarily in an array,
# and also feeds it line by line to the external app 'md5sum' which generates a unique checksum for it.
@chaicko
chaicko / zsh.md
Created October 3, 2016 18:09 — forked from tsabat/zsh.md
Getting oh-my-zsh to work in Ubuntu
#!/bin/bash
[ -d /usr/share/fonts/opentype ] || sudo mkdir /usr/share/fonts/opentype
sudo git clone --depth 1 --branch release https://github.com/adobe-fonts/source-code-pro.git /usr/share/fonts/opentype/scp
sudo fc-cache -f -v