Skip to content

Instantly share code, notes, and snippets.

@javikalsan
javikalsan / postgis_ha_trigger.txt
Created February 10, 2014 11:20
Trigger for postgis to calculate geometry area on hectares
SELECT AddGeometryColumn('geoms', 'the_geom', 25830, 'MULTIPOLYGON', 2 );
Trigger sup. ha
BEGIN
IF (TG_OP = 'INSERT') THEN
NEW.supha := area(NEW.the_geom)/10000;
ELSIF (TG_OP = 'UPDATE') THEN
IF NOT (NEW.the_geom ~= OLD.the_geom) THEN
NEW.supha := area(NEW.the_geom)/10000;
@javikalsan
javikalsan / apache mod_pagespeed sample code
Created February 10, 2014 17:49
apache mod_pagespeed sample configuration
<IfModule pagespeed_module>
ModPagespeed on
ModPagespeedFileCachePath /var/mod_pagespeed/cache/
# Direct Apache to send all HTML output to the mod_pagespeed output handler.
AddOutputFilterByType MOD_PAGESPEED_OUTPUT_FILTER text/html
# Turn this on if /var/mod_pagespeed/cache/ is on a ext3 filesystem.
ModPagespeedSharedMemoryLocks on
@javikalsan
javikalsan / PHPDoc-function.sublime-snippet
Created February 11, 2014 12:46
PHPDoc Sublime Text 2 snippet
<snippet>
<content><![CDATA[/**
* ${4:undocumented function}
*
* @param $7
* @return ${5:void}
* @author ${PHPDOC_AUTHOR:$TM_FULLNAME}$6
*
**/
$1function $2($3)
@javikalsan
javikalsan / linux users executing system proceses
Created February 13, 2014 07:44
linux users executing system proceses
ps aux | cut -d " " -f1 | sort | uniq | grep -v USER
@javikalsan
javikalsan / Postgresql Import dump file to local database
Last active May 11, 2018 16:27
Postgresql Import dump file to local database
psql -U postgres -W -d database_name -f my_dump_file.sql -h localhost
@javikalsan
javikalsan / execute_on_router.sh
Created March 26, 2014 15:59
Simple Bash Script to execute a command on the router through telnet command
#!/bin/sh
# replace cmd1 for the command to execute
host=192.168.1.1
port=23
user=myuser
pass=mypass
cmd1='ifconfig wl0 down'
( echo open ${host}
git config --global alias.st "status -s"
git config --global alias.puom "push -u origin master"
git config --global alias.lol "log --all --graph --decorate"
git config --global alias.com "checkout master"
git config --global alias.cod "checkout dev"
git config --global alias.b "branch"
@javikalsan
javikalsan / gist:9a16eca771348ff3ef85
Created August 8, 2014 11:25
Search Wordpress version of all projects under directory
egrep 'wp_version =' `find . -name version.php`
@javikalsan
javikalsan / gist:18e526f5292f59ec2f62
Created August 18, 2014 18:41
SublimeText Preferences
{
"color_scheme": "Packages/Color Scheme - Default/Blackboard.tmTheme",
"font_size": 12,
"translate_tabs_to_spaces": true,
"tab_size": 2,
"scroll_speed": 2.0,
"folder_exclude_patterns": [".svn", ".git", "._d", ".metadata", ".settings"],
"file_exclude_patterns": ["*.pyc", "*.pyo", ".project", "*.jpg", "*.png", "*.gif"],
"detect_indentation": true,
"detect_slow_plugins": false,
@javikalsan
javikalsan / sublimetext-plugin-list
Last active August 29, 2015 14:05
SublimeText Plugin Lists
DocBlockr
HTML/CSS/JS Prettify
Brack­etHigh­lighter
SublimeLinter
PHPUnit Completions
ColorHighlighter
SublimeCodeIntel
Emmet
Colorsublime
SidebarEnhancements