Skip to content

Instantly share code, notes, and snippets.

@PaulChana
PaulChana / RelToAbs.sh
Created July 24, 2015 13:06
Relative To Abs Path in Bash using Python
the_path=$(python -c "import os,sys; print os.path.realpath(sys.argv[1])" "../../some/relative/path")
@PaulChana
PaulChana / UnhideLibrary
Created December 9, 2015 11:58
Unhide user library
/usr/bin/chflags nohidden ~/Library
@PaulChana
PaulChana / average.sh
Created February 3, 2016 16:39
Find average file size
# Thanks to http://vivekjain10.blogspot.co.uk/2008/02/average-file-size-within-directory.html
find . -type f -name *.wav -print0 | xargs -0 ls -l | awk '{sum += $5; n++;} END {print sum/(n-1)/1024/1024;}'
@PaulChana
PaulChana / LLDB Printf
Last active December 1, 2016 17:21
LLDB Printf
expr (int) printf("%f %d %f %d", x, y, z, q)
@PaulChana
PaulChana / functionTiming.cpp
Created April 14, 2016 08:05
Timing function C++11
#include <iostream>
#include <cmath>
#include <iomanip>
#include <chrono>
int fun(const int a, const int b, const int c) {
return a * b * c;
}
int main(int argc, const char * argv[]) {
@PaulChana
PaulChana / LLDB Hardware Watchpoints
Created April 26, 2016 09:20
LLDB Hardware Watchpoints
watch set expression (int *)0x12345678 (or w s e (int *)0x12345678)
@PaulChana
PaulChana / ArchFromBinary.sh
Last active May 12, 2016 06:30
Get arch from binary
lipo -info /usr/lib/libiodbc.a
@PaulChana
PaulChana / VSArray
Created May 12, 2016 13:19
View Array in Visual studi
If you have a buffer named, say, buf, write this in the watch window:
buf, 200
And VS will show you the first 200 elements of the array.
@PaulChana
PaulChana / LLDB Print Array
Last active February 11, 2024 12:58
View array in LLDB
p *(int(*)[10])ptr
@PaulChana
PaulChana / cmdline.txt
Last active September 6, 2016 07:29
Force raspberry pi to break its startup sequence
rw init=/bin/bash