Skip to content

Instantly share code, notes, and snippets.

View gayanvirajith's full-sized avatar
:octocat:

Gayan Virajith gayanvirajith

:octocat:
View GitHub Profile
@gayanvirajith
gayanvirajith / ubuntu-date-time.md
Created December 23, 2016 11:09
Set date/time configuration on ubuntu

Set timezone

sudo dpkg-reconfigure tzdata

Set date time

sudo date --set "23 Dec 2016 4:36:00"

@gayanvirajith
gayanvirajith / ubuntu-mysqlnd.md
Last active November 21, 2016 07:37
Ubuntu mysqlnd

List ondrej trusty list

sudo ls /etc/apt/sources.list.d

move ondrej-php5-5_6-trusty.list to home (idea is to delete)

sudo mv /etc/apt/sources.list.d/ondrej-php5-5_6-trusty.list ~/

Add new ppa

@gayanvirajith
gayanvirajith / git-patch-usage.md
Last active November 1, 2016 09:18
Git apply patch

If you haven't commited the changes, then:

git diff > mypatch.patch But sometimes it happens that part of the stuff you're doing are new files that are untracked and won't be in your 'git diff' output. So, one way to do a patch is to stage everything for a new commit (but don't do the commit), and then:

git diff --cached > mypatch.patch Add the 'binary' option if you want to add binary files to the patch (i.e. mp3 files):

git diff --cached --binary > mypatch.patch You can later apply the patch:

@gayanvirajith
gayanvirajith / android-sqlite-database.md
Last active June 13, 2020 06:54
Connect to Sqlite3 via Android ADB Shell

Connect to Sqlite3 via ADB Shell

Enter the command adb devices to get the list of your devices: ~/Android/Sdk/platform-tools/adb devices

Connect a shell to your device: ~/Android/Sdk/platform-tools/adb -s emulator-5584 shell

Navigate to the folder containing your db file: cd data/data//databases/

@gayanvirajith
gayanvirajith / copy.sh
Created October 17, 2016 05:20
Terminal copy with progress
# Copy
rsync -ah --info=progress2 earn2learn-dev-gayan earn2learn-dev-gayan-10102016-4
@gayanvirajith
gayanvirajith / enable-ssh-ubuntu.md
Last active September 1, 2016 05:40
Enable ssh ubuntu

Enable SSH in ubuntu

sudo apt-get update

sudo apt-get install openssh-server

sudo ufw allow 22

@gayanvirajith
gayanvirajith / artisan-thinker.php
Last active September 15, 2017 16:10
Laravel 5 listen database queries in php artisan tinker
<?php
/*
* php artisan tinker => and put following closure in.
* This will listen for database queries
* and print them on tinker the fly
*/
DB::listen(function ($query) {
var_dump($query->sql);
});
@gayanvirajith
gayanvirajith / how-to-install-node-in-ubuntu.md
Last active July 25, 2016 04:08
How to install node & npm on ubuntu 16
@gayanvirajith
gayanvirajith / lsof-check.sh
Created July 11, 2016 09:17
Find process locking port 3000 on Mac
# Credit: http://stackoverflow.com/a/3855359
lsof -i tcp:3000
@gayanvirajith
gayanvirajith / top-10-large-directories-command.sh
Created June 20, 2016 04:59
Get the top 10 largest directories on Linux
# Credit: http://www.keyboardninja.eu/linux/find-the-10-largest-directories-in-linux
du -BM / | sort -n -r | head -n 10