Skip to content

Instantly share code, notes, and snippets.

View josue's full-sized avatar
:shipit:
Crushing it from 1999 to Present

Josué Rodriguez josue

:shipit:
Crushing it from 1999 to Present
View GitHub Profile
@josue
josue / client-startup.sh
Created August 21, 2014 20:13
Checks if client services (ElasticSearch + background jobs) are running
#!/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 / check_if_beast.hs
Created July 18, 2014 19:18
Experimenting with Haskell - simple script that reads name, validates with functions and writes output to file.
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 / nginx_s3_proxy.conf
Last active March 7, 2023 07:31
Simple Nginx Proxy to S3 Bucket Asset
server {
listen 80;
listen 443 default_server ssl;
ssl on;
ssl_certificate /etc/ssl/certs/myssl.crt;
ssl_certificate_key /etc/ssl/private/myssl.key;
server_name *.example.com;
root /var/www/vhosts/website;
@josue
josue / dump-resque-failed-jobs
Last active August 29, 2015 13:57
Dump all resque-web failed jobs from IP address
#!/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 / diff-uniq
Created December 30, 2013 16:42
Output unique lines not common in two files.
#!/bin/sh
FILE1=$1
FILE2=$2
grep -n -v "`cat $FILE1`" $FILE2
@josue
josue / gonna.learn.today.js
Last active December 16, 2015 15:28
MESSING WITH DAVID TO SEE IF HE IS REALLY TESTING
(function(){
if(window.console && (Math.round(Math.random() * 10))<7) {
var a = (Math.round(Math.random() * 2)) % 2 ? 'background-image:url(http://i.imgur.com/hHcgxw9.gif); padding:0 0px 185px 45px; color:red;' : 'background-image:url(http://i.imgur.com/67qDKDC.gif); padding:0 0px 225px 355px; color:red;';
console.log("%c Here is a bug for you\n\n"+(new Array(18)).join("\n"),a);
}
})();
@josue
josue / cs-error.sh
Last active December 11, 2015 14:18
#!/usr/sh
curl -s http://pastebin.com/raw.php?i=gWHNJQyE
say "Happy Birthday to You, Happy Birthday to You"
say "Happy Birthday Dear Andre Castillo, Happy Birthday to You."
say "From good friends and true,"
say "From old friends and new,"
say "May good luck go with you,"
say "And happiness too."
echo "\n\nHappy Birthday Peter :)\n"
@josue
josue / export_db_table_schemas.sh
Created October 10, 2012 22:14
Export DB Table Schemas: Creates an SQL schema file for each table without the table data.
#!/bin/bash
# Usage: ./export_db_table_schemas.sh {custom directory}
MYSQL_USER="{username}"
MYSQL_PWD="{password}"
MYSQL_DB="{database}"
[ "$1" != "" ] && SQL_DIR=$1 || SQL_DIR="schemas"
mkdir -p $SQL_DIR
@josue
josue / ui.filterlist.js
Created September 5, 2012 18:19
Filter an object for matching fields.
/*
Author: Josue Rodriguez <josue@josuerodriguez.com> -- MIT License -- (c) 2012
Purpose: Filter an object list
Usage:
<input type="text" id="filter_list">
<div id="my_list">
<div data-id="{id}">{label}</div>
<div data-id="{id}">{label}</div>
<div class="hide" id="list_empty">Non Available</div>
@josue
josue / jquery.onEnterKey.js
Created June 15, 2012 20:57
jQuery: onEnterKey trigger
$(function(){
$.fn.onEnterKey = function(opts,callback){
var opt = typeof target==="object" && target || {};
var target = opts.target || typeof opts===jQuery && opts || typeof opts==="string" && opts || null;
var callback = opt.callback || typeof opts==="function" && opts || typeof callback==="function" && callback || function(target){
$(target).trigger("click");
};
return this.live("keypress.onEnterKey",function(e){
if(e.keyCode==13) {
callback.call(this,target);