Skip to content

Instantly share code, notes, and snippets.

View dharma017's full-sized avatar

Dharma R. Thapa dharma017

  • Melbourne, Australia
View GitHub Profile
@dharma017
dharma017 / linux-commands.md
Last active September 22, 2015 08:45
Linux useful commands

####Find large files by showing the usage of each folder / file from smallest to largest on the box

du -k | sort -n | perl -ne 'if ( /^(\d+)\s+(.*$)/){$l=log($1+.1);$m=int($l/log(1024)); printf  ("%6.1f\t%s\t%25s  %s\n",($1/(2**(10*$m))),(("K","M","G","T","P")[$m]),"*"x (1.5*$l),$2);}'
@dharma017
dharma017 / wp-db-migrate.md
Created September 14, 2015 12:43
Wordpress DB Migration

Wordpress DB Migration

Normal Site Tables

UPDATE `wp_commentmeta` SET `meta_value` = replace(meta_value, 'http://olddomain.com', 'http://newdomain.com');
UPDATE `wp_comments` SET `comment_content` = replace(comment_content, 'http://olddomain.com', 'http://newdomain.com');
UPDATE `wp_options` SET `option_value` = replace(option_value, 'http://olddomain.com', 'http://newdomain.com');
UPDATE `wp_posts` SET `post_content` = replace(post_content, 'http://olddomain.com', 'http://newdomain.com');
UPDATE `wp_posts` SET `guid` = replace(guid, 'http://olddomain.com', 'http://newdomain.com');
@dharma017
dharma017 / surplus-empty-lines.txt
Created September 14, 2015 12:11
Surplus Empty Lines (ST3)
^\s+$
Select the text
Press Ctrl + H (or click Find->Replace)
Make sure you have selected 'regular expression' (press Alt + R)
Find what: ^\n
Replace With: (nothing, leave in blank)
@dharma017
dharma017 / project-setup-with-sync-assets-and-db.md
Last active September 16, 2015 05:14
Setup wordpress project in office for first time to work between development and staging server

Project Setup

Create Database on Staging Server

ssh root@xx.xxx.xxx.xx
mysql -uroot -pREMOTE_MYSQL_ROOT_PASSWORD
create database REMOTE_DBNAME COLLATE 'utf8_unicode_ci';
show databases;

exit

@dharma017
dharma017 / swedish-character-covert.txt
Created September 14, 2015 11:01
Game sound conversion for office game project
Ogg Sound Replace Format
_ space
å _ao_
ä _ae_
ö _oe_
Mp3=> CBR 64kbps
ogg => VBR quality level 1
@dharma017
dharma017 / fill-hitarea.js
Created September 14, 2015 10:59
Fill hitarea with rectangular graphics in pixi js
for (var i = 0; i < 4; i++) {
var x1 = this.dropParams.position[i * 2],
y1 = this.dropParams.position[i * 2 + 1],
x2 = this.dropParams.position[i * 2] + this.dropParams.w,
y2 = this.dropParams.position[i * 2 + 1] + this.dropParams.h;
var otherObject = new PIXI.DisplayObjectContainer();
var graphics = new PIXI.Graphics();
graphics.beginFill(0xFFFFFF, 0.5);
graphics.lineStyle(1, 0x000000, 0.5);
@dharma017
dharma017 / finally.slim
Last active September 14, 2015 06:38 — forked from wesbos/finally.slim
Slim IE Conditional Tags
/[if IE 8]
| <html class="ie8 lt-ie9" lang="en">
/[if IE 9]
| <html class="ie9" lang="en">
/! [if (gte IE 9)|!(IE)]<!--> <html lang="en"> <!--<![endif]
@dharma017
dharma017 / Cobal2-Preferences.sublime-settings
Last active August 12, 2016 11:26
My Sublime Text 3 setup
{
"binary_file_patterns":
[
"nodde_modules/",
"vendor",
"tmp/",
"bower_components/"
],
"bold_folder_labels": true,
"caret_extra_bottom": 2,
@dharma017
dharma017 / install-webmin-on-ubuntu-server.md
Created September 14, 2015 05:31
Install Webmin On Ubuntu Server

Add the webmin official repository:

Edit file /etc/apt/sources.list,

sudo vi /etc/apt/sources.list

Add the following lines:

@dharma017
dharma017 / get-started-with-zsh.md
Created September 14, 2015 05:26
Getting Started With Zsh

Zsh is a much better bash.

It is a command line shell that will improve your productivity. For example, it can autocomplete common commands. If you type git a, it will prompt add, am, etc.. And it has community driven theme.

Install ZSH sudo apt-get install zsh

To get started, go to oh-my-zsh on github.