Skip to content

Instantly share code, notes, and snippets.

View arturoleon's full-sized avatar

Arturo Leon arturoleon

View GitHub Profile
@arturoleon
arturoleon / app.js
Created September 14, 2012 04:58
Stream video to ios/android
// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor('#000');
VideoStreamingTest = {};
Ti.include('streamingvideo.js');
// create tab group
var tabGroup = Titanium.UI.createTabGroup();
@arturoleon
arturoleon / app.js
Last active January 6, 2018 03:55
Loading window for Titanium Mobile
//Usage example
var win = Ti.UI.createWindow();
var loadingWindow = require('LoadingWindow')();
win.add(loadingWindow);
//win.remove(loadingWindow)
win.open();
@arturoleon
arturoleon / file.js
Created September 20, 2012 13:47
Fix booxtrap dropdown on iPad
$('body').on('touchstart.dropdown', '.dropdown', function (e) { e.stopPropagation(); });
@arturoleon
arturoleon / gist:4145331
Created November 25, 2012 21:06
Titanium Mobile: Remove all childrens recursively from an object
function removeChildrens(objeto) {
for (i in objeto.children) {
var child=objeto.children[0];
removeChildrens(child);
objeto.remove(child);
child=null;
}
}
@arturoleon
arturoleon / gist:5193620
Created March 19, 2013 03:56
Remove al messages from exim queue
exim -bpru|awk {'print $3'}|xargs exim -Mrm
@arturoleon
arturoleon / gist:5193631
Created March 19, 2013 03:59
List the connections per IP given a specific port (80 in this case).
netstat -plan |grep :80 | awk '{print $5}' |cut -d: -f1 |sort |uniq -c |sort -nr
@arturoleon
arturoleon / gist:5215543
Created March 21, 2013 18:40
Show accesses by IP.
cat /var/log/httpd/access.log | awk '{print $1}'| sort -n | uniq -c | sort -rn | head -n10
@arturoleon
arturoleon / gist:5407715
Created April 17, 2013 20:56
Sinatra over SSL
#from http://blog.divebomb.org/2012/01/ruby-sinatra-and-ssl/
require 'sinatra/base'
require 'webrick'
require 'webrick/https'
require 'openssl'
name = "/C=US/ST=SomeState/L=SomeCity/O=Organization/OU=Unit/CN=localhost"
ca = OpenSSL::X509::Name.parse(name)
key = OpenSSL::PKey::RSA.new(1024)
crt = OpenSSL::X509::Certificate.new
crt.version = 2
@arturoleon
arturoleon / s3backup.rb
Created May 29, 2013 04:33
Script to copy incremental daily cpanel backups to a S3 bucket.
require 'rubygems'
require 'aws-sdk'
backup_dir = "/backup/cpbackup/" #end with /
users = "appspinc,arturo" #cpanel accounts to backup
users = users.split(",")
bucket = 'BUCKET_NAME'
@arturoleon
arturoleon / gist:5833945
Created June 21, 2013 20:07
Count and sort IP's by accesses number.
cat access_log |awk '{print $1}' |sort | uniq -c | sort -n