Skip to content

Instantly share code, notes, and snippets.

@cbarraco
cbarraco / download-docker
Created March 2, 2019 21:02
Direct download link for Docker for Windows without signing in
https://download.docker.com/win/stable/Docker%20for%20Windows%20Installer.exe
@cbarraco
cbarraco / gradle.properties
Created February 25, 2019 03:19
Gradle build optimization for compiling Android apps
// Add this in your global gradle.properties file
// at ~/.gradle/gradle.properties
// Enable Gradle Daemon
org.gradle.daemon=true
// Enable Configure on demand
org.gradle.configureondemand=true
//Enable parallel builds
org.gradle.parallel=true
// Enable Build Cache
android.enableBuildCache=true
@cbarraco
cbarraco / install-latest-cmake.sh
Last active January 29, 2019 15:28
Downloads, compiles, and installs the latest version of CMake. Replace 4 with however many CPU cores the machine has. If using the Raspberry Pi, use 2 instead of 4 because you may run out of memory.
git clone https://github.com/Kitware/CMake.git
cd CMake
./bootstrap --parallel=4
make -j 4
sudo make install
<Target Name="NSwag Debug" AfterTargets="Build" Condition="'$(Configuration)'=='DEBUG'">
<Exec Command="$(NSwagExe) run Debug.nswag" />
</Target>
<Target Name="NSwag Release" AfterTargets="Build" Condition="'$(Configuration)'=='RELEASE'">
<Exec Command="$(NSwagExe) run Release.nswag" />
</Target>
@cbarraco
cbarraco / Open bash shell here.reg
Created October 14, 2017 20:04
Add an explorer context menu item for opening a bash for windows shell in the current directory
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\Background\shell\bash]
@="Open bash shell here"
"Icon"="%USERPROFILE%\\AppData\\Local\\lxss\\bash.ico"
[HKEY_CLASSES_ROOT\Directory\Background\shell\bash\command]
@="C:\\Windows\\System32\\bash.exe"
@cbarraco
cbarraco / exception_signal_handler.c
Created October 7, 2016 15:11
Registers a signal handler that handles exceptions by outputting the program backtrace. Use with the debug flag to include line numbers.
#include <execinfo.h>
#include <stdio.h>
#include <signal.h>
/**
* Outputs the backtrace if the application crashes
* @param signal The signal that was sent when the application crashed
*/
void exception_signal_handler(int signal) {
const int num_backtraces = 20;
@cbarraco
cbarraco / stackoverflow-line-numbers.js
Last active September 9, 2016 21:20
Adds line numbers to code on stackoverflow.com
var code_blocks = $("pre > code");
code_blocks.prepend("1\t");
for (var b = 0; b < code_blocks.length;b++) {
var newlines = $(code_blocks[b]).find("span.pln");
var c = 1;
for (var i=0;i < newlines.length;i++) {
newlines[i].innerHTML = newlines[i].innerHTML.replace(/(?:\r\n|\r|\n)/g, function(x) {
return "\n" + ++c + "\t";
});
}
adb shell "run-as package.name chmod 666 /data/data/package.name/databases/file"
adb pull /data/data/package.name/databases/file .
adb shell "run-as package.name chmod 600 /data/data/package.name/databases/file"
https://raw.githubusercontent.com/vosh/scripts/master/pacman
https://raw.githubusercontent.com/vosh/scripts/master/rallyx
https://raw.githubusercontent.com/vosh/scripts/master/slendy
https://raw.githubusercontent.com/vosh/scripts/master/invaders
#!/bin/bash
exec 3<> /dev/tcp/${1:-www.cyberciti.biz}/80
printf "GET / HTTP/1.0\r\n" >&3
printf "Accept: text/html, text/plain\r\n" >&3
printf "Accept-Language: en\r\n" >&3
printf "User-Agent: nixCraft_BashScript v.%s\r\n" "${BASH_VERSION}" >&3
printf "\r\n" >&3
while read LINE <&3