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:e95cdc230d1ac5b824b3
Created May 9, 2015 01:15
Install rbenv in CentOS 7
# install build dependencies
sudo yum install -y git-core zlib zlib-devel gcc-c++ patch readline readline-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison curl sqlite-devel
# clone and install rbenv environment
cd ~
git clone git://github.com/sstephenson/rbenv.git .rbenv
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/bin:$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
@soardex
soardex / gist:9aaa125448f74b393981
Created May 17, 2015 14:13
Convert img to vdi using VirtualBox
# here is the code to convert img to vdi format
# it is useful especially for uefi based image
VBoxManage convertfromraw --format VDI [filename].img [filename].vdi
@soardex
soardex / gist:8a56f5856bff417a2c96ec1fd26906e5
Created March 25, 2017 14:16
Use Test User To Test Messenger Bot
To get it to work please follow the steps:
1) Create test user by toggling the Authorize test users for this app and grant permissions "manage_pages" and "page_messaging".
2) Use the Edit Button and get an access token for this user (using v2.6). Please save this for later.
3) Use edit button to login as the test user
4) After login, create page as the test user
5) Use the user access token for the test user to get the page access token for this user. You can do this with the following call:
~~~
https://graph.facebook.com/v2.6/me/accounts?access_token=<TEST_USER_ACCESS_TOKEN>
~~~
@soardex
soardex / gist:bd588f633d03d8bd0f84
Created June 24, 2015 06:34
Encrypted .netrc for Git
# encrypt ~/.netrc with gpg agent
gpg -e -r [your_gpg_id] ~/.netrc
# clean removed .netrc file
shred ~/.netrc
rm -f ~/.netrc
# enable credential helper
# this would search files in your home directory
# .authinfo.gpg
@soardex
soardex / gist:5f47dc1e022697abe1400ec1601dfeb9
Last active October 5, 2022 19:49
MongoDB Create And Authenticate Using Users
1. Connect to mongodb instance.
~~~
mongod --port 27017 --dbpath /data/db
~~~
2. Create user:
~~~
use admin
db.createUser(
{
@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: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:b8599a257f210917a666
Created June 19, 2015 11:54
Deprecated Linux Commands
Deprecated command Replacement command(s)
arp ip n (ip neighbor)
ifconfig ip a (ip addr), ip link, ip -s (ip -stats)
iptunnel ip tunnel
iwconfig iw
nameif ip link, ifrename
netstat ss, ip route (for netstat-r), ip -s link (for netstat -i), ip maddr (for netstat-g)
route ip r (ip route)
@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