Skip to content

Instantly share code, notes, and snippets.

antoni

Block or report user

Report or block antoni

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@antoni
antoni / android_get_db.sh
Created Apr 13, 2014
Pulls SQlite database from Android device
View android_get_db.sh
#!/bin/bash
REQUIRED_ARGS=2
PULL_DIR="./"
ADB_PATH=`which adb`
if [ $? -ne 0 ]
then
echo "Could not find adb!"
exit 1
fi;
View gist:ab29e5d2a9aee3aeea41
# Move code from one repo to another, preserving commit history
# Source: http://stackoverflow.com/a/17373088/963881
cd repo2
git checkout master
git remote add r1remote **url-of-repo1**
git fetch r1remote
git merge r1remote/master
git remote rm r1remote
# Push to master without having to --set-upstream-to first
View tmux.md

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

# remap prefix to Control + a
View portable_endian.h
// "License": Public Domain
// I, Mathias Panzenböck, place this file hereby into the public domain. Use it at your own risk for whatever you like.
// In case there are jurisdictions that don't support putting things in the public domain you can also consider it to
// be "dual licensed" under the BSD, MIT and Apache licenses, if you want to. This code is trivial anyway. Consider it
// an example on how to get the endian conversion functions on different platforms.
#ifndef PORTABLE_ENDIAN_H__
#define PORTABLE_ENDIAN_H__
#if (defined(_WIN16) || defined(_WIN32) || defined(_WIN64)) && !defined(__WINDOWS__)
View installActivator.sh
#!/bin/bash
# From ScalaCourses.com Introduction to Play Framework with Scala course
set -eo pipefail
function help {
echo "Download or update Typesafe Activator on Linux and Cygwin"
echo "Usage: $(basename $0) [options]"
echo "Options are:"
View lxc-centos
#!/bin/bash
#
# template script for generating CentOS container for LXC
#
#
# lxc: linux Container library
# Authors:
@antoni
antoni / bash_scripts.sh
Created May 21, 2015
Various bash scripts
View bash_scripts.sh
# (1) mv with regexp
for i in *; do mv -n "$i" "${i/_*dpi*}".png; done;
# (2) Loop over array of strings
declare -a arr=("element1" "element2" "element3")
## now loop through the above array
for i in "${arr[@]}"
do
echo "$i"
View python-shorts.py
# Time functions
import timeit
timeit.timeit(a, number=1)
@antoni
antoni / cuda.snippets
Last active Aug 29, 2015
CUDA snippets for Vim, should be put in: `~/.vim/bundle/vim-snippets/snippets`
View cuda.snippets
extends cpp
# CUDA
## CUDA Functions
snippet sync
__syncthreads();
${1}
snippet thsync
View tmux-cheatsheet.markdown

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
You can’t perform that action at this time.