Skip to content

Instantly share code, notes, and snippets.

View ferronrsmith's full-sized avatar
⛱️
Chilling on the beach

Ferron H ferronrsmith

⛱️
Chilling on the beach
View GitHub Profile
cd ~
sudo apt-get update
sudo apt-get install openjdk-7-jre-headless -y
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch and replace wget link below
# NEW WAY / EASY WAY
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.1.1.deb
sudo dpkg -i elasticsearch-1.1.1.deb
@ferronrsmith
ferronrsmith / striptags.js
Created October 7, 2014 04:52
strip html tags in js
var StrippedString = OriginalString.replace(/(<([^>]+)>)/ig,"");
@ferronrsmith
ferronrsmith / tmux.md
Last active August 29, 2015 14:07 — forked from andreyvit/tmux.md

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@ferronrsmith
ferronrsmith / finch.md
Created October 9, 2014 07:51
finch shorcuts

Abbreviations

M- means hold the META or EDIT or ALT key down while typing . If there is no META, EDIT or ALT key, instead press and release the ESC key and then type in quick succession.

How do I switch between windows?

You can press M-n/M-p to go to the next/previous window, or M-N where N is 1-9. You can also press M-w to bring out a list of all the windows. In the window list, you can select a row and press return to go to that window.

How can I close a window?

#!/bin/sh
# Quick start-stop-daemon example, derived from Debian /etc/init.d/ssh
set -e
# Must be a valid filename
NAME=foo
PIDFILE=/var/run/$NAME.pid
#This is the command to be run, give the full pathname
DAEMON=/usr/local/bin/bar
#!/bin/bash
#
# httpd Startup script for the Apache HTTP Server
#
# chkconfig: - 85 15
# description: The Apache HTTP Server is an efficient and extensible \
# server implementing the current HTTP standards.
# processname: httpd
# config: /etc/httpd/conf/httpd.conf
# config: /etc/sysconfig/httpd

Sample service script for debianoids

Look at LSB init scripts for more information.

Usage

Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
@ferronrsmith
ferronrsmith / clean_empty_folder.sh
Created February 10, 2015 01:31
cleaning empty folder on linux
#!/bin/bash
readonly PROGNAME=$(basename "$0")
function clean_empty_folders(){
local PROC_ID="$$"
local PROC_LS="$(ps -e aux | grep "${PROGNAME} -" | grep -v -e "${PROC_ID}" | awk '{print $2}')"
if [ "$(echo ${PROC_LS} | wc -l)" -gt 0 ]; then
kill -9 ${PROC_LS} 2> /dev/null
@ferronrsmith
ferronrsmith / gcloud.md
Created February 10, 2015 17:06
Gcloud create image from instance
  • First create your image using the gcloud computer instance create method
  • ssh into the box and perform all modifications
  • delete the instance using the following command : `gcloud compute instances delete <instance_name> --keep-disks boot
    • this command will remove the instance, leaving only the disk.
  • create an image from the disk using the following command :
    • gcloud compute images create example-image --source-disk example-disk --source-disk-zone ZONE
@ferronrsmith
ferronrsmith / path.sh
Last active August 29, 2015 14:16
reading file paths into an array
#!/bin/bash
ARRAY=()
while read -r line; do
ARRAY+=("$line")
done <<< "$(find /tmp -type f)"
echo "${ARRAY[@]}"