Skip to content

Instantly share code, notes, and snippets.

View henryhamon's full-sized avatar
🏠
Working from home

Henry Hamon henryhamon

🏠
Working from home
View GitHub Profile
@kirkgo
kirkgo / inflections.rb
Last active June 5, 2018 19:17
Pluralization in brazilian portuguese through REGEX for Ruby on Rails
ActiveSupport::Inflector.inflections do |inflect|
inflect.plural /ao$/i, 'oes'
inflect.singular /oes$/i, 'ao'
inflect.plural /l$/i, 'is'
inflect.singular /is$/i, 'l'
inflect.plural /or$/i, 'ores'
inflect.singular /ores$/i, 'or'
end
@sepastian
sepastian / zebra.rb
Last active January 15, 2018 07:28
Print a label on a Zebra TLP 2844 in Ruby. The printer is EPL/2 capable and connected via USB.
# Print a label on a Zebra TLP 2844 in Ruby.
# The printer is EPL/2 capable and connected via USB.
# EPL/2 reference: http://www.zebra.com/apps/dlmanager?dlp=-227178c9720c025483893483886ea54a70963bb77ca94fcc1d65ce9394326ed960e43d023beba35831d5d9bfc1740296347157b5024977a&c=gb&l=en
# https://github.com/larskanis/libusb
require 'libusb'
# Select the printer by vendor ID and product ID.
# To get a list of connected devices, use 'lsusb'.
# 0a5f:0x000a identifies the Zebra TLP 2844.
@kevin-smets
kevin-smets / iterm2-solarized.md
Last active November 14, 2024 15:40
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

# Retorna dados sobre o pregão
http://www.bmfbovespa.com.br/Pregao-Online/ExecutaAcaoCarregarDados.asp?CodDado=IBOV,ticker&CA=undefined
# Retorna ações e seus últimos valores negociados
http://www.bmfbovespa.com.br/Pregao-OnLine/ExecutaAcaoCarregarDados.asp?CodDado=Ticker
# Retorna o histórico do dia de um papel
http://www.bmfbovespa.com.br/Pregao-Online/ExecutaAcaoCarregarDadosPapeis.asp?CodDado=petr4
# Retorna dados de um papel
@dankrause
dankrause / custom-tinycore.sh
Last active April 13, 2024 10:50
Create a custom tinycore linux iso. Adjust the config at the beginning of the script, or supply a conf as the first arg. Requires xorriso.
#!/bin/bash
set -e
function cleanup() {
# clean up our temp folder
rm -rf "${TMPDIR}"
}
trap cleanup EXIT
@indraniel
indraniel / toy-bleve-example.go
Last active October 9, 2023 13:05
This is a toy search example using bleve. It also highlights how to retrieve the orignal input document(s) from the KV store.
package main
// mentioned in bleve google group
// https://groups.google.com/forum/#!topic/bleve/-5Q6W3oBizY
import (
"encoding/json"
"fmt"
"github.com/blevesearch/bleve"
"github.com/blevesearch/bleve/document"
@techfort
techfort / electroloki
Created May 1, 2015 12:38
basic loading of LokiJS in an electron app
var app = require('app'); // Module to control application life.
var BrowserWindow = require('browser-window'); // Module to create native browser window.
var loki = require('lokijs'),
db = new loki(),
users = db.addCollection('users', {
indices: ['username']
});
users.insert({ username: 'joe', age: 40});
users.insert({ username: 'jack', age: 30});
@madhums
madhums / gin_html_render.go
Last active August 18, 2022 07:53
render html templates in gin (go)
// Package GinHTMLRender provides some sugar for gin's template rendering
//
// This work is based on gin contribs multitemplate render https://github.com/gin-gonic/contrib/blob/master/renders/multitemplate
//
// Usage
//
// router := gin.Default()
//
// // Set html render options
// htmlRender := GinHTMLRender.New()
@ericboehs
ericboehs / install.sh
Last active March 14, 2017 16:55
Install Docker on El Capitan
# Ensure you have brew cask installed http://caskroom.io
brew install caskroom/cask/brew-cask
# Install Docker Toolbox (this will install docker machine and virtualbox)
brew cask install dockertoolbox
# Create a linux machine for docker container to run on
docker-machine create --driver virtualbox default
# Add ENV variables for the machine to your profile (and restart your terminal)
@subfuzion
subfuzion / curl.md
Last active November 11, 2024 03:27
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.