Skip to content

Instantly share code, notes, and snippets.

@antoni
antoni / android_get_db.sh
Created April 13, 2014 08:38
Pulls SQlite database from Android device
#!/bin/bash
REQUIRED_ARGS=2
PULL_DIR="./"
ADB_PATH=`which adb`
if [ $? -ne 0 ]
then
echo "Could not find adb!"
exit 1
fi;
@antoni
antoni / gist:ab29e5d2a9aee3aeea41
Last active December 29, 2022 14:30
Git cheat sheet
# 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
@antoni
antoni / tmux.md
Last active August 29, 2015 14:19 — forked from andreyvit/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

// "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__)
#!/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:"
@antoni
antoni / lxc-centos
Last active August 29, 2015 14:21 — forked from hagix9/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 10:56
Various bash scripts
# (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"
@antoni
antoni / python-shorts.py
Created May 31, 2015 21:06
python-shorts.py
# Time functions
import timeit
timeit.timeit(a, number=1)
@antoni
antoni / cuda.snippets
Last active August 29, 2015 14:24
CUDA snippets for Vim, should be put in: `~/.vim/bundle/vim-snippets/snippets`
extends cpp
# CUDA
## CUDA Functions
snippet sync
__syncthreads();
${1}
snippet thsync

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname