Skip to content

Instantly share code, notes, and snippets.

@shamangeorge
shamangeorge / devicemotion.css
Last active December 17, 2015 22:59
Device Motion events Javascript
#deviceMotionVariables {
text-align: justify;
width: 200px;
border: 5px solid black;
position: absolute;
right: 10%;
top: 5%;
display: none;
}
@shamangeorge
shamangeorge / backup
Created July 21, 2013 17:47
basic archive rotation backup script
#!/bin/bash
####################################
#
# Backup to NFS mount script with
# grandfather-father-son rotation.
#
####################################
# What to backup.
backup_files="/home /var/www /var/spool/mail /etc /root /boot /opt"
@shamangeorge
shamangeorge / apache-custom-directory
Last active December 22, 2022 07:00
apache virtual host with custom directory index configuration
<VirtualHost *:80>
ServerName www.example.com
# For local dev machines
ServerAlias staging.www.example.com
ServerAlias dev.www.example.com
DocumentRoot /var/www/www.example.com
<Directory /var/www/www.example.com>
Options +FollowSymlinks +Multiviews +Indexes
@shamangeorge
shamangeorge / get_vagrants.sh
Last active December 25, 2015 04:09
Get all vagrants
for url in `curl http://www.vagrantbox.es | grep '<td>h' | sed 's/<th scope="row">//g' | sed 's/<\/td>//g' | sed 's/<td>//g' | sed '/goo.gl/d' | sed 's/\ //g'`; do file=`echo $url | sed 's/\ //g' | sed 's/\///g' | sed 's/disk1//g' | sed 's/http\://g' | sed 's/https\://g'`; vagrant box add $file $url; done;
@shamangeorge
shamangeorge / findgitconfigs.sh
Created October 16, 2013 15:19
find all gitconfigs in dir and subdirs
dir = 1$
for gitconfig in `find $dir -wholename "*.git/config" -type f`;do nano "$gitconfig"; done
@shamangeorge
shamangeorge / regexp.sh
Last active December 25, 2015 23:29
Useful bash regexp methods
egrep -o '([0-9]{1,3}\.){3}[0-9]{1,3}' # finds ips in a file
# From http://stackoverflow.com/questions/1444406/how-can-i-delete-duplicate-lines-in-a-file-in-unix/1444448#1444448
# delete duplicate, consecutive lines from a file (emulates "uniq").
# First line in a set of duplicate lines is kept, rest are deleted.
sed '$!N; /^\(.*\)\n\1$/!P; D'
# delete duplicate, nonconsecutive lines from a file. Beware not to
# overflow the buffer size of the hold space, or else use GNU sed.
sed -n 'G; s/\n/&&/; /^\([ -~]*\n\).*\n\1/d; s/\n//; h; P'
@shamangeorge
shamangeorge / .gdbinit_objc
Last active December 26, 2015 15:49
Reverse Engineering tools
fb -[NSException raise]
fb -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:]
fb -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:]
#define NSZombies
# this will give you help messages. Set to NO to turn them off.
set env MallocHelp=YES
# might also be set in launch arguments.
set env NSZombieEnabled=YES
set env NSDeallocateZombies=NO
@shamangeorge
shamangeorge / disable_scroll.js
Last active December 29, 2015 20:19
How to disable scrolling temporarily JS
// From http://stackoverflow.com/questions/4770025/how-to-disable-scrolling-temporarily
// left: 37, up: 38, right: 39, down: 40,
// spacebar: 32, pageup: 33, pagedown: 34, end: 35, home: 36
var keys = [37, 38, 39, 40];
function preventDefault(e) {
e = e || window.event;
if (e.preventDefault)
e.preventDefault();
e.returnValue = false;
@shamangeorge
shamangeorge / crayola.json
Last active November 8, 2020 21:55 — forked from jjdelc/crayola.json
Official Crayola Colors hex and rgb values in JSON
[
{
"hex": "#EFDECD",
"name": "Almond",
"rgb": "(239, 222, 205)"
},
{
"hex": "#CD9575",
"name": "Antique Brass",
"rgb": "(205, 149, 117)"
@shamangeorge
shamangeorge / index.html
Last active April 6, 2016 10:49
CSS3 covering bakground technique
<!doctype html>
<html>
<head>
<style>
html {
background: url('./pandora.jpg') no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;