Skip to content

Instantly share code, notes, and snippets.

Avatar
:shipit:
Crushing it from 1999 to Present

Josué Rodriguez josue

:shipit:
Crushing it from 1999 to Present
View GitHub Profile
@josue
josue / es_quick_info.sh
Created Aug 26, 2015
ElasticSearch - Displays quick indices info (name / size / count / alias)
View es_quick_info.sh
#!/bin/sh
# Ensure file is executable: chmod +x es_quick_info.sh
# Use given host or default to localhost
[ "$1" != "" ] && HOST=$1 || HOST="localhost:9200"
ES_EXIST=`curl -s "$HOST" | grep 'ok'`
if [ "$ES_EXIST" = "" ]; then
@josue
josue / dump-resque-failed-jobs
Last active Aug 29, 2015
Dump all resque-web failed jobs from IP address
View dump-resque-failed-jobs
#!/bin/sh
# To extract from localhost '127.0.0.1:6379', you can quickly do:
# usage: curl -L http://git.io/dump-resque-failed-jobs-test | sh
[ "$1" != "" ] && IP=$1 || IP=127.0.0.1
[ "$2" != "" ] && PORT=$2 || PORT=6379
redis-cli -h $IP -p $PORT LRANGE resque:failed 0 -1
@josue
josue / check_if_beast.hs
Created Jul 18, 2014
Experimenting with Haskell - simple script that reads name, validates with functions and writes output to file.
View check_if_beast.hs
import System.Environment
import Data.Char
main = promptNameAndSave
matchesName s = if (map toUpper s) == "JOSUE" then True else False
checkIfBeast str = if matchesName str then "a BEAST !" else "normal."
finalMessage h i = "Thanks " ++ h ++ ", you are " ++ i
@josue
josue / client-startup.sh
Created Aug 21, 2014
Checks if client services (ElasticSearch + background jobs) are running
View client-startup.sh
#!/bin/sh
CLIENT=$1
DIR_DEPLOY="/var/www/vhosts/deploy"
CLIENT_DIR="$DIR_DEPLOY/$CLIENT"
echo "- Switching to client dir: $CLIENT_DIR"
cd $CLIENT_DIR
echo
@josue
josue / mixpanel.php
Created Dec 16, 2014
Mixpanel - Simple PHP wrapper using only the mixpanel.track() endpoint.
View mixpanel.php
<?php
// Mixpanel - Simple wrapper using only the mixpanel.track() endpoint.
function Mixpanel($event, $props = array(), $distinct_id = 0) {
$api_key = '{api-key}';
$data = array(
'event' => $event,
'properties' => array(
'distinct_id' => $distinct_id,
'token' => $api_key,
'time' => time()
@josue
josue / start-mysql-sniffer
Created May 27, 2015
Start/Stop mysql-sniffer and log data to file
View start-mysql-sniffer
#!/bin/sh
APP="mysql-sniffer"
LOG="/tmp/mysql-sniffer.log"
PID=""
get_pid () {
PID=`ps aux | grep "$APP" | grep -v grep | grep -v "$0" | awk '{ print $2 }'`
}
View Ubiquity--PHP-basic-function-reference-search.js
CmdUtils.CreateCommand({
names: ["php"],
icon: "http://static.php.net/www.php.net/favicon.ico",
description: "Check PHP function specs and comments. (v0.4)",
help: "PHP",
author: {name: "Josue Rodriguez", email: "josue@josuerodriguez.com"},
license: "MIT",
homepage: "http://josuerodriguez.com",
arguments: [
{role: "object", label: 'function', nountype: noun_arb_text}
View Git_Publish_To_Shared_Server.sh
#!/bin/bash
# ========== Your Server Config ==========
# your SSH credentials ...
SSH_User="user"
SSH_Host="server.com"
# directory where the tar.gz file will be uploaded then extracted from.
# recommened it be root directory so when you untar it falls nicely into place...
WWW_Dir="html/"
View php_syntax_checker.sh
#!/bin/bash
# Author: Josue Rodriguez (@JosueR)
# Grabs the current pwd via Git repo then performs a php syntax on all php files.
me="$(basename "$(test -L "$0" && readlink "$0" || echo "$0")")"
Git_Root=$(readlink -f ./$(git rev-parse --show-cdup))
option=$1
files_found=0
counter=0
View tweet
#!/bin/bash
# file: tweet
# NOTE: make sure to put this file in '/usr/bin' and make it executable: sudo chmod +x /usr/bin/tweet
# usage: tweet "hello from CLI"
user="USERNAME"
pass="PASSWORD"
tweet=$1