Skip to content

Instantly share code, notes, and snippets.

@ManishLSN
ManishLSN / tmux-cheatsheet.markdown
Created December 8, 2017 06:37 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@ManishLSN
ManishLSN / Converter.class.php
Created November 22, 2017 12:07 — forked from gabrieljmj/Converter.class.php
Currency converter using Google API You must have the curl extension in PHP active.
<?php
/**
* @author @GabrielJMJ /twitter
* @description Abstract class to define a interface of a converter
* @link https://gist.github.com/GabrielJMJ/6977968 Gist on GitHub
**/
abstract class Converter{
protected $valueWithCurrency;
protected $toCurrency;
@ManishLSN
ManishLSN / postgres-cheatsheet.md
Created September 15, 2017 06:21 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@ManishLSN
ManishLSN / node-and-npm-in-30-seconds.sh
Created May 3, 2017 12:27 — forked from isaacs/node-and-npm-in-30-seconds.sh
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@ManishLSN
ManishLSN / db-connect-test.php
Created February 8, 2017 11:06 — forked from chales/db-connect-test.php
Script for a quick PHP MySQL DB connection test.
<?php
# Fill our vars and run on cli
# $ php -f db-connect-test.php
$dbname = 'name';
$dbuser = 'user';
$dbpass = 'pass';
$dbhost = 'host';
$connect = mysql_connect($dbhost, $dbuser, $dbpass) or die("Unable to Connect to '$dbhost'");