Skip to content

Instantly share code, notes, and snippets.

View avargas's full-sized avatar

Angelo Vargas avargas

View GitHub Profile
@avargas
avargas / gist:7226558
Created October 30, 2013 02:58
emergency vnc
$ x11vnc -rfbport 1111 -display :1
server {
root /www/site/;
server_name site.com *.site.com;
location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ {
access_log off;
log_not_found off;
expires 360d;
}
@avargas
avargas / invalidate.py
Last active December 16, 2015 17:28
invalidates cloudfront files easily
import argparse, boto
AWS_ACCESS_KEY = ''
AWS_SECRET_KEY = ''
AWS_CLOUDFRONT_ID = ""
def invalidate (f, print_debug=False):
from boto.cloudfront import CloudFrontConnection
con = CloudFrontConnection(AWS_ACCESS_KEY, AWS_SECRET_KEY)
@avargas
avargas / gist:5109610
Created March 7, 2013 16:53
returns an array of start and end ip ranges in int
def cidr_range(cidr):
ip, subnet = cidr.split('/')
ipint = ip2int(ip)
subnet = int(subnet)
mask = ''.join(['1' for num in range(subnet)] + ['0' for num in range(32 - subnet)])
inverted_mask = ''.join(['0' for num in range(subnet)] + ['1' for num in range(32 - subnet)])
mask_int = int(mask, 2)
>>> a = None
>>> type(a)
<type 'NoneType'>
>>> a = 1
>>> type(a)
<type 'int'>
>>> a = "angelo"
>>> type(a)
((320*320) * 10) * 0.073
CSS:
#preview-foot {
position:absolute;
border:1px solid #ccc;
background:#333;
padding:5px;
display:none;
color:#fff;
ini_set('log_errors', 'On');
ini_set('error_log', __DIR__ . '/phperrors.log');
ini_set('log_errors_max_len', 0);
<script>
$(document).ready(function() {
$(".boton")
.bind("touchstart", function () {
$(this).addClass("active");
})
.bind("touchend", function() {
$(this).removeClass("active");
})
.bind("touchcancel", function() {
@avargas
avargas / gist:2624785
Created May 6, 2012 22:08
autorun command automatically
<?php
class Colors {
private $foreground_colors = array();
private $background_colors = array();
public function __construct() {
// Set up shell colors
$this->foreground_colors['black'] = '0;30';
$this->foreground_colors['dark_gray'] = '1;30';