Skip to content

Instantly share code, notes, and snippets.

@gld1982ltd
gld1982ltd / pm
Created October 1, 2014 14:53
pm - package management with pacman and yaourt
#/bin/sh
# pm - Custom Pacman functions
# usage pm [option] [package(s)]
case $1 in
-i) yaourt -S "${@:2}" ;;
-u) yaourt -Syua "${@:2}" ;;
-r) sudo pacman -Rns "${@:2}" ;;
-s) yaourt -Ss "${@:2}" ;;
-q) yaourt -Qi "${@:2}" ;;
info) yaourt -Si "${@:2}" ;;
@gld1982ltd
gld1982ltd / flexbox.less
Last active August 29, 2015 14:07 — forked from jayj/flexbox.less
Flexbox Less Mixins
// --------------------------------------------------
// Flexbox LESS mixins
// The spec: http://www.w3.org/TR/css3-flexbox
// --------------------------------------------------
// Flexbox display
// flex or inline-flex
.flex-display(@display: flex) {
display: ~"-webkit-@{display}";
display: ~"-moz-@{display}";
@gld1982ltd
gld1982ltd / clone-all-user-github-repos.sh
Last active November 26, 2015 06:07 — forked from caniszczyk/clone-all-twitter-github-repos.sh
Clone all repos from a GitHub organization
user="gld1982ltd"
curl -s https://api.github.com/users/$user/repos?per_page=200 | ruby -rubygems -e 'require "json"; JSON.load(STDIN.read).each { |repo| %x[git clone #{repo["ssh_url"]} ]}'
@gld1982ltd
gld1982ltd / fix-pacman-key
Created November 28, 2015 07:30
fix-pacman-key
#!/bin/bash
#
# Run this script as root to fix errors related to pacman-key
rm -rf /etc/pacman.d/gnupg/
rm -rf /root/.gnupg/ # only if the directory exists
gpg --refresh-keys
pacman-key --init && pacman-key --populate
pacman-key --refresh-keys
@gld1982ltd
gld1982ltd / merge-css.js
Created December 10, 2015 17:12 — forked from pritambaral/merge-css.js
Merge Duplicate CSS rules; detected by selector
#!/usr/bin/env node
if (process.argv.length < 3) {
console.error('Usage:', process.argv.join(' '), '/path/to/file.css');
process.exit(1);
}
file = process.argv[2];
var fs = require('fs');
@gld1982ltd
gld1982ltd / genpasswd
Created July 1, 2013 22:18
Generate a random password of specified length. e.g. "genpasswd 8" without quotes generates a random 8 digit password.
genpasswd() {
local l=$1
[ "$l" == "" ] && l=16
tr -dc A-Za-z0-9_ < /dev/urandom | head -c ${l} | xargs
}
#!/bin/bash
#-------------------------------------------------------------------------------
#Created by helmuthdu mailto: helmuthdu[at]gmail[dot]com
#Inspired by Andreas Freitag, aka nexxx script
#-------------------------------------------------------------------------------
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation, either version 3 of the License, or
#(at your option) any later version.
#
@gld1982ltd
gld1982ltd / fabfile1.py
Last active December 19, 2015 13:29 — forked from kespindler/gist:2415840
Directory push/pull with python fabric
from fabric.api import *
from fabric.contrib import project as project
SYNC_DIR = 'MY_DIRECTORY'
def push():
local('rsync -avz --exclude fabfile.py --exclude fabfile.pyc . %s' % SYNC_DIR)
def pull():
local('rsync -avz --exclude fabfile.py --exclude fabfile.pyc %s .' % SYNC_DIR)
@gld1982ltd
gld1982ltd / fabfile.py
Created July 10, 2013 02:20 — forked from pix0r/fabfile.py
Sample Fabric environment setup
from fabric.api import env, run
from fabric.contrib.project import rsync_project
try:
from fabfile_local import *
except ImportError, e:
environments = {
"dev": {
"hosts": ["localhost"],
},
@gld1982ltd
gld1982ltd / wordlist.py
Last active December 19, 2015 14:49 — forked from samuraisam/wordlist.py
random words
This file has been truncated, but you can view the full file.
import random
def random_words(num, separator='-'):
"""
Return `num`-random concatinated to each other.
They will be joined by `separator`
"""