Skip to content

Instantly share code, notes, and snippets.

@jpina
jpina / keybase.md
Created May 13, 2017 17:09
keybase

Keybase proof

I hereby claim:

  • I am jpina on github.
  • I am jpina (https://keybase.io/jpina) on keybase.
  • I have a public key ASDkCQurr4F2S8brFVZ5iTkJJD0J1ExG5S0dDMSdpw92fgo

To claim this, I am signing this object:

@jpina
jpina / upgrade_ibus_1.5.md
Last active October 11, 2018 08:58
Upgrade ibus to 1.5 in Ubuntu 14.04

Upgrade ibus to v1.5.x in Ubuntu 14.04

Install dependencies

sudo apt-get update -qq
sudo apt-get install -y gtk+-2.0 gtk+-3.0
sudo apt-get install -y libdconf-dev libnotify-dev
sudo apt-get install -y libdbus-1-dev
@jpina
jpina / rsync.md
Last active December 27, 2016 17:19
Sync your local files against a remote

Sync your local files against a remote

$ rsync --partial --progress --rsh=ssh SOURCES DEST_HOST:DEST_PATH

Example

@jpina
jpina / docker_oracle.md
Last active April 14, 2023 17:08
Start Oracle 11g Express in a docker container

Oracle 11g Express in a docker container

Start the container:

docker run -d --name oracle -p 49160:22 -p 49161:1521 \
-e ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe \
-e ORACLE_SID=xe \
-e TNS_ADMIN=$ORACLE_HOME/network/admin \
-e SQLPLUS=$ORACLE_HOME/bin/sqlplus \
@jpina
jpina / oracle_backup_restore.md
Last active January 8, 2016 21:49
Restore an Oracle database backup

Restore an Oracle database backup

unzip zipped_file_with_sql_contents.zip
sed -i 's/SCHEMA/SCHEMA2/g' file.sql
sqlplus sys/PASSWORD@xe as sysdba

sqlplus> @/path/to/file.sql
@jpina
jpina / 0_reuse_code.js
Created January 4, 2016 09:43
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@jpina
jpina / 08_why_not_callbacks.md
Created November 25, 2015 11:05
08 Why (not) callbacks?

Why (not) callbacks?

asyncCall(function(err, data1){
    if(err) return callback(err);       
    anotherAsyncCall(function(err2, data2){
        if(err2) return calllback(err2);
        oneMoreAsyncCall(function(err3, data3){
            if(err3) return callback(err3);
 // are we done yet?
@jpina
jpina / 01_promise.js
Created November 25, 2015 11:04
01 Promise API
var promise = new Promise(function(resolve, reject) {
// do a thing, possibly async, then…
if (/* everything turned out fine */) {
resolve("Stuff worked!");
}
else {
reject(Error("It broke"));
}
});
@jpina
jpina / 02_how_to_use_a_promise.js
Created November 25, 2015 11:04
02 How to use a promise
promise.then(function(result) {
console.log(result); // "Stuff worked!"
}, function(err) {
console.log(err); // Error: "It broke"
});
@jpina
jpina / 03_promisifying_xmlhttprequest.js
Created November 25, 2015 11:03
03 Promisifying XMLHttpRequest
function get(url) {
// Return a new promise.
return new Promise(function(resolve, reject) {
// Do the usual XHR stuff
var req = new XMLHttpRequest();
req.open('GET', url);
req.onload = function() {
// This is called even on 404 etc
// so check the status