Skip to content

Instantly share code, notes, and snippets.

View lgomez's full-sized avatar

Luis G. Gómez lgomez

View GitHub Profile
var MapSymbol = function() {
var canvas = document.createElement("canvas");
var context = canvas.getContext("2d");
canvas.width = width;
canvas.height = height;
context.clearRect(0,0,width,height);
context.save();
context.beginPath();
// Restify Server CheatSheet.
// More about the API: http://mcavage.me/node-restify/#server-api
// Install restify with npm install restify
// 1.1. Creating a Server.
// http://mcavage.me/node-restify/#Creating-a-Server
var restify = require('restify');
@dmpeters
dmpeters / librets_install.txt
Created July 15, 2014 21:56
librets installations with python bindings only
# Debian 7 x64, Ubuntu 14.04 x64, Ubuntu 12.04.4 x64
*NOTE (tested on Digital Ocean VM's w/ > 512MB of RAM - gcc runs out of memory on VM's <= 512 MB)
apt-get update
aptitude safe-upgrade
apt-get install build-essential libboost-all-dev libcurl4-gnutls-dev autoconf antlr swig python-dev
*NOTE (for python 3 support add 'python3-dev' to the end of line 5)
cd /tmp
wget https://github.com/NationalAssociationOfRealtors/libRETS/archive/1.6.1.tar.gz
@jimmyislive
jimmyislive / api_module.js
Last active January 3, 2018 17:45
Single Page App components
var cfg = require('../config').Config,
qs = require('querystring'),
request = require('request');
request = request.defaults({jar: true})
exports.awesome = function(req, res){
headers = {};
@pkuczynski
pkuczynski / parse_yaml.sh
Last active April 9, 2024 18:36
Read YAML file from Bash script
#!/bin/sh
parse_yaml() {
local prefix=$2
local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034')
sed -ne "s|^\($s\)\($w\)$s:$s\"\(.*\)\"$s\$|\1$fs\2$fs\3|p" \
-e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 |
awk -F$fs '{
indent = length($1)/2;
vname[indent] = $2;
for (i in vname) {if (i > indent) {delete vname[i]}}
@wboykinm
wboykinm / index.html
Last active October 25, 2017 02:46
Mapbox Geolocation by IP
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title></title>
<script src='http://api.tiles.mapbox.com/mapbox.js/v1.4.0/mapbox.js'></script>
<script src='http://codeorigin.jquery.com/jquery-1.10.2.min.js'></script>
<link href='http://api.tiles.mapbox.com/mapbox.js/v1.4.0/mapbox.css' rel='stylesheet' />
<!--[if lte IE 8]>
<link href='http://api.tiles.mapbox.com/mapbox.js/v1.4.0/mapbox.ie.css' rel='stylesheet'>
@yanatan16
yanatan16 / .mongorc.js
Last active June 27, 2022 09:03
My .mongorc.js file
(function () {
rcversion = '1.0';
load('underscore.min.js')
// NOTES
// Basics, wrap the whole thing in a function
// Set a version for sanity's sake
// Load underscore, a must in any javascript environment
@markjaquith
markjaquith / gist:2628225
Last active March 29, 2023 23:30
Script to sync WordPress SVN to GitHub
#!/bin/bash
# cd into the directory
cd ~/gitsync/github-wordpress-sync/;
# Make sure we are not already running
if [ -f .sync-running ];then
if test ! `find ".sync-running" -mmin +10`;then
# Currently running, but not stuck
exit 1;
fi
fi;
@charlesdaniel
charlesdaniel / basic_auth_nodejs_test.js
Created January 27, 2012 02:53
Example of HTTP Basic Auth in NodeJS
var http = require('http');
var server = http.createServer(function(req, res) {
// console.log(req); // debug dump the request
// If they pass in a basic auth credential it'll be in a header called "Authorization" (note NodeJS lowercases the names of headers in its request object)
var auth = req.headers['authorization']; // auth is in base64(username:password) so we need to decode the base64
console.log("Authorization Header is: ", auth);
@bradland
bradland / ssh-known-hosts-mgmt.sh
Last active April 4, 2023 21:21
SSH known_hosts tools
# This is a short collection of tools that are useful for managing your
# known_hosts file. In this case, I'm using the '-f' flag to specify the
# global known_hosts file because I'll be adding many deploy users on this
# system. Simply omit the -f flag to operate on ~/.ssh/known_hosts
# Add entry for host
ssh-keyscan -H github.com >> /etc/ssh/ssh_known_hosts
# Scan known hosts
ssh-keygen -f /etc/ssh/ssh_known_hosts -F github.com