Skip to content

Instantly share code, notes, and snippets.

View racheats's full-sized avatar
👋
Open for Collaboration!

Zhao racheats

👋
Open for Collaboration!
View GitHub Profile
@racheats
racheats / prepare-ubuntu16.04
Created February 6, 2019 13:06
Prepare script for initialize ubuntu 16.04
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "Please run as root"
exit
fi
# update package
apt update -y
apt upgrade -y
@racheats
racheats / install-node.sh
Created January 26, 2019 03:44
Setup for nodejs installation on ubuntu xenial 16.04
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "Please run as root"
exit
fi
wget https://nodejs.org/dist/v8.9.0/node-v8.9.0-linux-x64.tar.xz
mv node-v8.9.0-linux-x64.tar.xz /opt/node-v8.9.0-linux-x64.tar.xz
@racheats
racheats / install-mailhog.sh
Created January 23, 2019 14:09
Setup for mailhog installation on ubuntu xenial 16.04
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "Please run as root"
exit
fi
MAILHOG_URL=github.com/mailhog/MailHog
MHSENDMAIL_URL=github.com/mailhog/mhsendmail
MAILHOG_EXECUTABLE=/usr/local/bin/mailhog
@racheats
racheats / prepare-ubuntu-xenial.sh
Created January 19, 2019 04:01
Minimalist prepare script for ubuntu
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "Please run as root"
exit 100
fi
# script dir location
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
@racheats
racheats / prepare-centos7.sh
Created January 16, 2019 08:37
Basic provision script for centos 7
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "Please run as root"
exit 100
fi
yum update -y
yum install -y epel-release yum-utils git wget localinstall mysql57-community-release-el7-7.noarch.rpm \
@racheats
racheats / install-go.sh
Created January 12, 2019 08:22
Install golang on ubuntu 16.04
#!/bin/bash
# run => bash <script>
if [[ $EUID -ne 0 ]]; then
echo "Please run as root"
exit 100
fi
# updating package & upgrade security
package com.racheats.sigoes.splash;
import android.Manifest;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Typeface;
import android.os.Build;
import android.os.Handler;
import android.support.v4.app.ActivityCompat;
import android.util.Log;
import android.widget.Toast;
import java.io.File;
import java.io.IOException;
import android.net.Uri;
import android.database.Cursor;
import android.provider.MediaStore;
import android.os.AsyncTask;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
@racheats
racheats / handlebars-helper-x.js
Created April 9, 2017 11:45 — forked from akhoury/handlebars-helper-x.js
Handlebars random JavaScript expression execution, with an IF helper with whatever logical operands and whatever arguments, and few more goodies.
// for detailed comments and demo, see my SO answer here http://stackoverflow.com/questions/8853396/logical-operator-in-a-handlebars-js-if-conditional/21915381#21915381
/* a helper to execute an IF statement with any expression
USAGE:
-- Yes you NEED to properly escape the string literals, or just alternate single and double quotes
-- to access any global function or property you should use window.functionName() instead of just functionName()
-- this example assumes you passed this context to your handlebars template( {name: 'Sam', age: '20' } ), notice age is a string, just for so I can demo parseInt later
<p>
{{#xif " name == 'Sam' && age === '12' " }}
BOOM
@racheats
racheats / boot.js
Created May 22, 2016 09:26 — forked from jdx/boot.js
zero-downtime node.js app runner
// This script will boot app.js with the number of workers
// specified in WORKER_COUNT.
//
// The master will respond to SIGHUP, which will trigger
// restarting all the workers and reloading the app.
var cluster = require('cluster');
var workerCount = process.env.WORKER_COUNT || 2;
// Defines what each worker needs to run