Skip to content

Instantly share code, notes, and snippets.

View soardex's full-sized avatar

Edward Fitz Bucud Abucay soardex

View GitHub Profile
@soardex
soardex / gist:95afe3f168b4db461403
Created June 24, 2015 06:50
Encrypt msmtp Secrets
# create and encrypt ~/.msmtp/secrets.gpg
mkdir -p ~/.msmtp
echo -e "password\n" | gpg -e -r [your_gpg_id] -o ~/.msmtp/secrets.gpg
# in `.msmtprc` change the password to passwordeval to launch an external program.
passwordeval "gpg -q --for-your-eyes-only --no-tty -d ~/.msmtp/secrets.gpg"
@soardex
soardex / gist:8c3ac67914e5d4a13807
Last active August 29, 2015 14:24
NetEase music.163.com
#! /usr/bin/env python
# -*- coding: utf-8 -*-
## from https://github.com/yanunon/NeteaseCloudMusic
'''
Created on 2013-06-07 19:28
@author: Yang Junyong <[email protected]>
'''
@soardex
soardex / gist:84c67472dee43a65e344
Created July 3, 2015 08:49
NetEase music.163.com
## from https://gist.github.com/scturtle/5972996
import re
import os
import sys
import md5
import json
import random
import requests
@soardex
soardex / gist:3b088e71dde0e7361a1a
Created July 11, 2015 13:06
Dockerfile for vert.x with JVM
FROM centos:latest
MAINTAINER Fitz Abucay <[email protected]>
RUN yum update -y
RUN yum install -y deltarpm
RUN yum install -y java-1.7.0-openjdk-headless
ENV VERTX_HOME /opt/vertx
RUN mkdir -p $VERTX_HOME && \
@soardex
soardex / gist:5474b5cf3f263d6acd77
Created July 11, 2015 15:31
Perlbrew on CentOS 7
# install perlbrew
sudo yum install -y perl perl-CPAN perl-CPAN-Meta
sudo cpan App::cpanminus
sudo cpanm install App::perlbrew
# install cpanm and perl latest
perlbrew install-cpanm
perlbrew install-patchperl
perlbrew install 5.22.0
@soardex
soardex / gist:062885a9aaa650dfc8d4
Created January 3, 2016 11:39
Repackage a CentOS 7 vagrant box
# update the box
sudo yum update -y
sudo yum clean all
# fill the empty spaces with zeroes
sudo dd if=/dev/zero of=/boot/EMPTY bs=1M
sudo rm -f /boot/EMPTY
sudo dd if=/dev/zero of=/EMPTY bs=1M
sudo rm -f /EMPTY
@soardex
soardex / gist:d9d3967832730bf4f5dd
Created January 18, 2016 10:19
My Most Used Docker Commands
# build docker config
docker build -t [name:tag] .
# inspecting containers
docker inspect [container-id]
# create an image from a container
docker commit -a [author] -m [message] [container-id] [name:tag]
# compare docker container with image
@soardex
soardex / gist:cf30a8d0673ba1e9f4d3
Created January 22, 2016 11:05
Awk Internal Variables
FILENAME: References the current input file.
FNR: References the number of the current record relative to the current input file. For instance, if you have two input files, this would tell you the record number of each file instead of as a total.
FS: The current field separator used to denote each field in a record. By default, this is set to whitespace.
NF: The number of fields in the current record.
NR: The number of the current record.
OFS: The field separator for the outputted data. By default, this is set to whitespace.
ORS: The record separator for the outputted data. By default, this is a newline character.
RS: The record separator used to distinguish separate records in the input file. By default, this is a newline character.
@soardex
soardex / gist:1a59c2cee24e6c9329cd
Created January 23, 2016 05:32
Vim Save On Read-Only File
# set autoread so there are no interactive Load File option
:set ar
# save the command using tee and discard tee echo
:w !sudo tee % > /dev/null
@soardex
soardex / gist:79700587cf706fcad4fa
Created January 23, 2016 05:45
Saving Sessions On Vim
# Saving Sessions
:mksession ~/cs.vim
# Loading Sessions
:source ~/cs.vim