Skip to content

Instantly share code, notes, and snippets.

View olragon's full-sized avatar
👨‍💻
I may be slow to respond.

Long Nguyen olragon

👨‍💻
I may be slow to respond.
  • Ho Chi Minh City, Viet Nam
View GitHub Profile
dependencies[] = ctools
; Views Handlers
files[] = views/mymodule_handler_handlername.inc
@olragon
olragon / .my.cnf
Created April 12, 2015 05:34
Backup MySQL databases, backup files split by date-time and database name
# file: /root/.my.cnf
[client]
user = MYSQL_USER
password = MYSQL_PASSWORD
host = MYSQL_HOST
{
"id": 9118195,
"name": "keyboard",
"full_name": "jasonrudolph/keyboard",
"owner": {
"login": "jasonrudolph",
"id": 2988,
"avatar_url": "https://avatars.githubusercontent.com/u/2988?v=3",
"gravatar_id": "",
"url": "https://api.github.com/users/jasonrudolph",

(a gist based on the old toolmantim article on setting up remote repos)

To collaborate in a distributed development process you’ll need to push code to remotely accessible repositories.

This is somewhat of a follow-up to the previous article setting up a new rails app with git.

For the impatient

Set up the new bare repo on the server:

# add the email package
meteor add email
@olragon
olragon / field_term_reference.php
Last active November 25, 2015 16:13
Drupal's entity_metadata_wrapper examples
// @see https://www.drupal.org/node/2378611#comment-9360381
$entity = entity_create('node', $values);
$wrapper = entity_metadata_wrapper('node', $entity);
$wrapper->field_my_term_reference->set(123);
$wrapper->save();
@olragon
olragon / jquery.limitedlist.js
Last active December 15, 2015 14:09
Hide item in list if we have more than specified items.
(function($) {
$.fn.limitedList = function(options) {
var settings = $.extend({
limit: 5,
moreText: '> Xem thêm',
lessText: '< Rút gọn'
}, options);
return this.each(function() {
@olragon
olragon / uninstall.sh
Created April 6, 2013 10:28
devstack complete purge
#!/usr/bin/env bash
./unstack.sh
sudo apt-get -y purge libvirt-bin qemu-kvm qemu bridge-utils dkms openvswitch-switch openvswitch-datapath-dkms rabbitmq-server dnsmasq iptables tgt
sudo rm -rf /etc/quantum
sudo rm -rf /etc/nova
sudo rm -rf /etc/glance
sudo rm -rf /var/lib/nova
sudo rm -rf /etc/libvirt/
sudo rm -rf /var/lib/libvirt/
sudo rm -rf /etc/tgt/conf.d
@olragon
olragon / count.sh
Last active February 2, 2016 07:44
Recursive count and sort by file extension in directory
find ./ -type f | grep -E ".*\.[a-zA-Z0-9]*$" | sed -e 's/.*\(\.[a-zA-Z0-9]*\)$/\1/' | sort | uniq -c | sort -n
@olragon
olragon / Install
Created February 2, 2016 11:45
phpbrew
# Install GD extension
phpbrew -d ext install gd -- --with-libdir=lib/x86_64-linux-gnu --with-gd=shared --enable-gd-native-ttf --with-jpeg-dir=/usr --with-png-dir=/usr --with-freetype-dir=/usr/include/freetype2/ft2build.h --with-xpm-dir=/usr