Skip to content

Instantly share code, notes, and snippets.

View peterchaula's full-sized avatar

Peter Chaula peterchaula

  • Johannesburg, South Africa
View GitHub Profile
/**
* Website: http://sourceforge.net/projects/simplehtmldom/
* Additional projects: http://sourceforge.net/projects/debugobject/
* Acknowledge: Jose Solorzano (https://sourceforge.net/projects/php-html/)
*
* Licensed under The MIT License
* See the LICENSE file in the project root for more information.
*
* Authors:
adb shell "mkdir -p /sdcard/tunnel" #-p flag will make the mkdir silent if the dir already exists
adb shell "run-as <package-id> cp -r /data/data/<package-id>/ /sdcard/tunnel"
adb pull /sdcard/tunnel <destination-dir>/
@peterchaula
peterchaula / phone_numbers.cpp
Last active February 17, 2019 11:47
Put that cleanLine function back in
#include <iostream>
#include <fstream>
#include <cstdlib>
using namespace std;
//void function declaration
string cleanLine(string line);
int main( )
{
DATE="`date +%Y-%m-%d_%H_%M`"; \
git add .; \
git commit -m "Backup ${DATE}"; \
git push origin HEAD:backup-${DATE}
@peterchaula
peterchaula / history_stack.sh
Last active April 25, 2017 08:57
Implement a back stack in bash
#bash alias
alias cd="pushd . && cd"
@peterchaula
peterchaula / commit-and-push.sh
Created March 10, 2017 17:11
Commit and push in the case of a fire
DATE="`date +%Y-%m-%d_%H_%M`"; \
git add .; \
git commit -m "Save ${DATE}"; \
git push origin HEAD:backup-${DATE}
@peterchaula
peterchaula / benchmark.php
Last active December 30, 2016 08:45 — forked from BlakeGardner/benchmark.php
Benchmark of all the hashing algorithms provided by PHP
<?php
foreach (hash_algos() as $algo) {
$start_time = microtime(TRUE);
for ($index = 0; $index <= 500000; $index++) {
$hash = hash($algo, $index);
}
@peterchaula
peterchaula / clean-branches.sh
Created December 21, 2016 09:52
Leave master as the only branch
!#/bin/sh
git checkout master; \
git remote prune origin; \
for i in `git branch`; do
echo $i;
git branch -D $i;
done
@peterchaula
peterchaula / hello.bf
Created November 19, 2016 07:05
Hello world in Brainfuck
++++++++[->+++++++++<]>.>++++[<+++++++>-]<+.>[-]+++[<++>-]<+..+++.>+++++++++++[<------>-]<-.>++++[<--->-]<.>+++++++[<++++++++>-]<-.>++++++[<++++>-]<.+++.------.>++[<---->-]<.>+++++++++++[<------>-]<-.
/**
Fix this code
var multiplyByIndex = [];
for (var i = 0; i < 100; i ++) {
multiplyByIndex[i] = function(inputNum) {
return inputNum * i;
};
}