Skip to content

Instantly share code, notes, and snippets.

View karlitxo's full-sized avatar

karlitxo karlitxo

View GitHub Profile
@karlitxo
karlitxo / bongo.sh
Created August 13, 2016 00:22 — forked from smashew/bongo.sh
This one works... Tested
LOADING=false
usage()
{
cat << EOF
usage: $0 [options] dbname
OPTIONS:
-h Show this help.
-l Load instead of export
@karlitxo
karlitxo / auto_zoom_markers.js
Created September 20, 2016 10:10 — forked from chensoren/auto_zoom_markers.js
Auto Zoom To Fit All Markers on Google Maps API v3
var LatLngList = new Array (new google.maps.LatLng (52.537,-2.061), new google.maps.LatLng (52.564,-2.017));
// Create a new viewpoint bound
var bounds = new google.maps.LatLngBounds ();
// Go through each...
for (var i = 0, LtLgLen = LatLngList.length; i < LtLgLen; i++) {
// And increase the bounds to take this point
bounds.extend (LatLngList[i]);
}
// Fit these bounds to the map
map.fitBounds (bounds);
@karlitxo
karlitxo / CoreOS on XenServer
Created October 17, 2016 11:37 — forked from zebby76/CoreOS on XenServer
Install CoreOS to Disk in a VM on XenServer
Le support de Docker nativement par XenServer est actuellement disponible :
- http://xenserver.org/blog/entry/preview-of-xenserver-support-for-docker-and-container-management.html
- http://xenserver.org/partners/docker.html?id=159
Retour d'experience :
Création d'une VM avec Template CoreOS et utiliser le disque coreos_install_stable.iso pour booter.
- 2 disques supplémentaires sont nécessaires (pour l'utilisation du cloud-config) :
- Docker Space (xvdb)
@karlitxo
karlitxo / Gemfile
Created November 15, 2016 16:12
Sinatra + Mongoid CRUD Sample
source 'http://rubygems.org'
gem 'rack'
gem 'rack-flash'
gem 'thin'
gem 'sinatra', :require => 'sinatra/base'
gem 'mongoid'
gem 'bson_ext'
gem 'slim'
@karlitxo
karlitxo / ruby_ftp_example.rb
Created December 3, 2016 14:44 — forked from 3dd13/ruby_ftp_example.rb
Sample code of using Ruby Net::FTP library. Login to FTP server, list out files, check directory existence, upload files
require 'net/ftp'
CONTENT_SERVER_DOMAIN_NAME = "one-of-the-ftp-server.thought-sauce.com.hk"
CONTENT_SERVER_FTP_LOGIN = "saucy-ftp-server-login"
CONTENT_SERVER_FTP_PASSWORD = "saucy-ftp-server-password"
# LOGIN and LIST available files at default home directory
Net::FTP.open(CONTENT_SERVER_DOMAIN_NAME, CONTENT_SERVER_FTP_LOGIN, CONTENT_SERVER_FTP_PASSWORD) do |ftp|
files = ftp.list
@karlitxo
karlitxo / README.md
Created January 16, 2017 17:34 — forked from warmfusion/README.md
Cloud Init script for building a coreos cluster at home on XenServer using Cloud-Init and ETCD2

This Cloud-init script can be used to bootstrap a Xen based CoreOS server through Xen orchestra.

Features;

  1. Workaround for the lack of /etc/environment on 'unsupported' hypervisors
  2. Static IP allocation to deal with dhcp causing problems (On my network at least)
  3. etcd2 bootstrap discovery using public service and discovery tokens
    1. Manual reconfiguration to allow for membership changes after cluster is operational

Usage

@karlitxo
karlitxo / grafana custom.ini
Created February 5, 2017 17:07 — forked from mvadu/grafana custom.ini
nginx config for using grafana, Influxdb via reverse proxy with authentication
# The full public facing url
#root_url = %(protocol)s://%(domain)s:%(http_port)s/
root_url = http://localhost:80/grafana/
@karlitxo
karlitxo / pony-example.rb
Created June 8, 2017 12:23 — forked from pedrodelgallego/pony-example.rb
A working example of pony and sinatra.
# You need to install these gems.
# - smtp_tls
# - pony
post "/contact-us" do
Pony.mail :to => 'pedro.delgallego@gmail.com',
:from => "#{params[:email]}",
:subject => "Contact SFT : #{params[:name]}",
:body=> "#{params[:body]}, --- Contact Address #{params[:email]}",
:via => :smtp,
@karlitxo
karlitxo / decode_session_cookie.rb
Created July 25, 2017 11:14 — forked from profh/decode_session_cookie.rb
A simple script to decode Rails 4 session cookies
I am the owner of lvh.me. And I'm glad to hear it's helpful. In truth, it's just a fancy DNS trick. lhv.me and all of it's sub-domains just point back to your computer (127.0.0.1). That means running ssl is as simple (or difficult) as running ssl on your computer.
I'm not sure how comfortable you are with the command line, but here's my how I setup my development environment. (rvm, passenger, nginx w/ SSL, etc).
# Install rvm (no sudo!)
# ------------------------------------------------------
bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
source ~/.rvm/scripts/rvm
rvm install ree-1.8.7-2010.02