Skip to content

Instantly share code, notes, and snippets.

View angelbotto's full-sized avatar
🏃

Angel Celis Botto angelbotto

🏃
View GitHub Profile
@angelbotto
angelbotto / case-sensitive.rb
Created December 25, 2012 23:26
querry en mongomapper ignorando mayusculas y buscando letra o palabra especifica :) para crear buscadores :) se pueden hacer busquedas muy complejas :) super :)
@persons = Person.where(:$or => [{:name => {:$regex => /#{params[:search]}/i }}, {:username => {:$regex => /#{params[:search]}/i}} ] )
@angelbotto
angelbotto / imgfromcss.md
Last active December 10, 2015 03:28
extraer imagenes de un css y descargarlas con wget

#Descargar imagenes de un css

para dar solucion a un pequeño problema que tuve, que necesicaba extraer todas las imagenes de un archivo css en especial.

  1. extraemos las imagenes.
    grep -o 'http[a-zA-Z0-9/.:_-]*' test.css > test/images.txt

  2. descargamos las imagenes. wget -i test/images.txt

@angelbotto
angelbotto / check_cpu
Last active September 27, 2015 03:30
checks consul
#!/bin/bash
cpuused=`top -bn1 | grep "Cpu(s)" | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk '{print 100 - $1}'`
critical=90
warning=60
if [[ $cpuused > $critical ]]; then
echo "CPU CRITIC $cpuused"
exit 2
elif [[ $cpuused > $warning ]]; then
echo "CPU HIGH $cpuused"

With Heroku's JRuby support you may have already seen that you can run TorqueBox Lite on Heroku. But, that only gives you the web features of TorqueBox. What about scheduled jobs, backgroundable, messaging, services, and caching?

With a small amount of extra work, you can now run the full TorqueBox (minus STOMP support and clustering) on Heroku as well! I've successfully deployed several test applications, including the example Rails application from our Getting Started Guide which has a scheduled job, a service, and uses backgroundable and messaging.

This example uses TorqueBox 3.0.2, but the instructions may work with other TorqueBox versions.

Steps Required

  1. Create a JRuby application on Heroku, or convert an existing application to JRuby. Make sure your application works on JRuby on Heroku before throwing TorqueBox into the mix.
  2. Add th
@angelbotto
angelbotto / neo.nginx.conf
Created February 6, 2015 00:18
Configuracion para proxy con seguridad de auth
server {
listen 80;
server_name neo.cheersapp.io;
access_log /var/log/nginx/neo4j.access.log;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@angelbotto
angelbotto / init-deb.sh
Created February 5, 2015 19:35
nginx sh
#! /bin/sh
## Move the script to the init.d directory & make executable
#sudo mv init-deb.sh /etc/init.d/nginx
#sudo chmod +x /etc/init.d/nginx
## Add nginx to the system startup
#sudo /usr/sbin/update-rc.d -f nginx defaults
PATH=/opt/nginx/sbin:/sbin:/bin:/usr/sbin:/usr/bin
@angelbotto
angelbotto / nginx.conf
Created February 5, 2015 19:32
Cheers passenger recipe
#user nobody;
worker_processes 1;
events {
worker_connections 1024;
}
http {
passenger_root /usr/local/rvm/gems/jruby-1.7.18@cheers/gems/passenger-4.0.58;
@angelbotto
angelbotto / vineapi.md
Created October 20, 2014 21:59
vine api

Vine.app API Reference

The one and only public documentation of Vine.app 1.0.3

Common headers

user-agent: com.vine.iphone/1.0.3 (unknown, iPhone OS 6.1.0, iPhone, Scale/2.000000)
vine-session-id: <userid>-1231ed86-80a0-4f07-9389-b03199690f73
accept-language: en, sv, fr, de, ja, nl, it, es, pt, pt-PT, da, fi, nb, ko, zh-Hans, zh-Hant, ru, pl, tr, uk, ar, hr, cs, el, he, ro, sk, th, id, ms, en-GB, ca, hu, vi, en-us;q=0.8
//Invite all you friends in facebook :)
var elements = document.getElementsByClassName('uiButton');
for(var i=0;i<=elements.length;i++) { console.log(elements[i].click()); }
$.fn.textkolor = function(str) {
var hash = 0;
for (var i = 0; i < str.length; i++) {
hash = str.charCodeAt(i) + ((hash << 5) - hash);
}
var colour="#";
for (var j = 0; j < 3; j++) {
var value = (hash >> (j * 8)) & 0xFF; colour += ('00' + value.toString(16)).substr(-2);