Skip to content

Instantly share code, notes, and snippets.

View parvez's full-sized avatar
🦊
🚫 Chrome ❤️ Firefox

Parvez parvez

🦊
🚫 Chrome ❤️ Firefox
View GitHub Profile
@parvez
parvez / check_for_new_version.html
Created March 21, 2013 04:58
JavaScript + CSS based Update Check
<script>
var head = document.getElementsByTagName("head")[0];
var css = document.createElement('link');
css.type = 'text/css';
css.rel = 'stylesheet';
css.href = 'http://product.website.here/update_1.0.css?'+Date.now();
// css.href = 'http://product.website.here/update_1.2.css?'+Date.now(); Uncomment for version 1.2
css.media = 'screen';
head.appendChild(css)
</script>
@parvez
parvez / gist:5106409
Created March 7, 2013 08:19
Disable font enumeration for Adobe Flash
Disable font enumeration for Adobe Flash through mms.cfg:
DisableDeviceFontEnumeration=1
File Location:
32-bit Windows - %WINDIR%\System32\Macromed\Flash
64-bit Windows - %WINDIR%\SysWow64\Macromed\Flash
Macintosh - /Library/Application Support/Macromedia
Linux - /etc/adobe/
@parvez
parvez / gist:5095854
Created March 6, 2013 00:57
Awesome Cursor Movement
<!doctype html><meta charset='utf-8'>
<link rel='stylesheet' href='http://espadrine.github.com/aulx/demo/codemirror/lib/codemirror.css'>
<style>
div.CodeMirror-cursor {
transition-property: top, left;
transition-duration: 0.1s;
-webkit-transition-property: top, left;
-webkit-transition-duration: 0.1s;
-moz-transition-property: top, left;
-moz-transition-duration: 0.1s;
sudo ln /System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Resources/jsc /usr/local/bin/jsc
@parvez
parvez / watch_dir.sh
Created March 29, 2012 11:30
Watch a Directory
#!/bin/sh
while (true)
do
ls -la some/directory
sleep 1
clear
done
@parvez
parvez / htaccess
Created March 29, 2012 11:24
Force HTTPS with Rewrite Rule
RewriteEngine on
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^.*$ https://www.mydomain.com%{REQUEST_URI} [L,R]
RewriteCond %{HTTP_HOST} ^mydomain.com [NC]
RewriteRule ^.*$ https://www.mydomain.com%{REQUEST_URI} [L,R]
@parvez
parvez / console_colors.sh
Created March 29, 2012 11:19
Console Colors
LF="\n"; CR="\r"
INVT="\033[7m"; NORM="\033[0m"; BOLD="\033[1m"; BLINK="\033[5m"
#UNDR="\033[2m\033[4m"; EOL="\033[0K"; EOD="\033[0J"
UNDR="\033[4m"; EOL="\033[0K"; EOD="\033[0J"
SOD="\033[1;1f"; CUR_UP="\033[1A"; CUR_DN="\033[1B"; CUR_LEFT="\033[1D"
CUR_RIGHT="\033[1C"
#-- ANSI code
SCR_HOME="\033[0;0H" #-- Home of the display
@parvez
parvez / wifi_info_to_location.sh
Created March 29, 2012 11:15
wifi info to location
`airport -s -x | egrep 'BSSID|>CHANNEL<|NOISE|SSID_STR|RSSI' --after-context=1 \
| egrep -v "AGE|array|WPA|80211" | tr '\n' ' ' | tr -d '\t' \
| sed -e 's/<[^>]*>//g' \
-e 's/ -- /, /g' \
-e 'y/:/-/' \
-e 's/ \([0-9]\)-/ 0\1-/g' -e 's/-\([0-9]\)\([-|,]\)/-0\1\2/g' \
-e 's/BSSID \([a-f0-9-]*\)/{"mac_address": "\1"/g' \
-e 's/CHANNEL \([0-9]*\)/"channel": \1/g' \
-e 's/NOISE \([0-9]*\)/"signal_to_noise": \1/g' \
-e 's/RSSI \([0-9]*\)/"signal_strength": \1/g' \
@parvez
parvez / linked_list.rb
Created March 29, 2012 10:49
Linked List in Ruby
class LinkedList
include Enumerable
def initialize
@first = Node.new nil
@last = Node.new nil
@first.next = @last
@last.prev = @first
@parvez
parvez / .bash_profile
Created March 29, 2012 10:33
My Bash Profile - Quick
search() {
find . –name "*.*" -exec grep -l $1 {} \;
}
alias ll='ls -lha $1'
alias ..='cd ..'
alias ...='cd ../..'
convert2pdf() {
/System/Library/Printers/Libraries/convert -f "$1" -o "$2" -j "application/pdf"
}