Skip to content

Instantly share code, notes, and snippets.

View 0xqd's full-sized avatar
🚀
Buidl web3

jn 0xqd

🚀
Buidl web3
View GitHub Profile
@0xqd
0xqd / app.js
Created October 29, 2015 16:47 — forked from benlesh/app.js
Angular - Basics of Unit Testing a Controller
var app = angular.module('myApp', []);
/* Set up a simple controller with a few
* examples of common actions a controller function
* might set up on a $scope. */
app.controller('MainCtrl', function($scope, someService) {
//set some properties
$scope.foo = 'foo';
$scope.bar = 'bar';
angular.module('ionic.utils', [])
.factory('$localstorage', ['$window', function($window) {
return {
set: function(key, value) {
$window.localStorage[key] = value;
},
get: function(key, defaultValue) {
return $window.localStorage[key] || defaultValue;
},
(require 'evil)
(require 'evil-leader)
(require 'evil-surround)
(require 'evil-matchit)
(global-evil-matchit-mode t)
(evil-mode t)
(global-evil-leader-mode t)
(global-evil-surround-mode t)
@0xqd
0xqd / _docker.zsh
Created August 20, 2014 07:07
zsh - docker completition
#compdef docker
if (( CURRENT == 2 )); then
compadd $(docker ps -aq | xargs docker inspect --format '{{.Name}}' | cut -d "/" -f 2)
fi
@0xqd
0xqd / git_tips_n_tricks.sh
Created April 17, 2014 21:00
git tips and tricks
# git grep for file type
git grep res -- '*.js'
@0xqd
0xqd / vim_tips_and_tricks.vim
Created March 8, 2014 18:02
Vim tips and tricks
" copy a specific line in relativenumber mode and paste to current line
:<-/+ line>t.
@0xqd
0xqd / ruby_tips_and_tricks.rb
Last active August 29, 2015 13:56
ruby_tips_and_tricks
# rewrite url agnostic
html.gsub(/https?:\/\//, '//')
# build ruby from source
ruby_version=ruby-2.0.0-p451 && wget -c http://cache.ruby-lang.org/pub/ruby/2.0/$ruby_version.tar.gz && tar xvfz $ruby_version.tar.gz &&\
cd $ruby_version && ./configure --disable-install-rdoc && make install &&\
cd .. && rm -rf $ruby_version*
@0xqd
0xqd / lftp.conf
Created February 26, 2014 05:02 — forked from fxthomas/lftp.conf
## some useful aliases
alias ls "ls -h"
alias dir ls
alias less more
alias zless zmore
alias bzless bzmore
alias mirror "mirror -v"
alias sync "mirror -R -v -n"
alias reconnect "close; cache flush; cd ."
alias edit "eval -f \"get $0 -o ~/.lftp/edit.tmp.$$ && shell \\\"cp -p ~/.lftp/edit.tmp.$$ ~/.lftp/edit.tmp.$$.orig && $EDITOR ~/.lftp/edit.tmp.$$ && test ~/.lftp/edit.tmp.$$ -nt ~/.lftp/edit.tmp.$$.orig\\\" && put ~/.lftp/edit.tmp.$$ -o $0; shell rm -f ~/.lftp/edit.tmp.$$*\""
@0xqd
0xqd / postgresql_tips_and_tricks.sh
Last active August 29, 2015 13:56
postgresql tips and tricks
# backup database from one host to another
pg_dump --no-owner --no-acl <db-name> > backup
psql <to-db-name> < backup > /dev/null
@0xqd
0xqd / ffmpeg_tips_and_tricks.sh
Created February 2, 2014 16:13
FFmpeg tips and tricks
# convert mp4 to mp3
# source https://trac.ffmpeg.org/wiki/Encoding%20VBR%20(Variable%20Bit%20Rate)%20mp3%20audio
ffmpeg -i k.mp4 -q:a 0 -map a k.mp3