Skip to content

Instantly share code, notes, and snippets.

@ig10
ig10 / ipv4_binary.rb
Created April 21, 2016 05:55
Convert IPv4 to Binary numbers
octal, ipv4, input = [128, 64, 32, 16, 8, 4, 2, 1], [[],[],[],[]], nil
while input.nil? || input.split('.').size != 4 do
puts "Ingrese IPv4 a convertir"
input = gets.chomp
end
input = input.split('.').map(&:to_i)
ipv4.each_with_index do |binary_set, index|
@ig10
ig10 / inHourFilter.js
Created October 27, 2015 13:49
Translate Minutes to hours and minutes
function inHoursFilter(mins) {
// Return String with Qty of Hours and Mins
// REFACTOR!
var total = Math.round((parseFloat(mins)/60)*100)/100,
hours = Math.floor(total),
minutes = Math.round(parseFloat('0.'+ total.toString().split('.')[1]) * 100 ) / 100,
result = "";
if( hours === 0) {
return mins + ' mins';
@ig10
ig10 / kompass2015.js
Last active August 29, 2015 14:16
Auto Fill Kompass 2015 Apply Forms
javascript:((function registerKompass() {
var step1 = {
radio: ["rdoServiceIn_0"],
common: {
"txtLastName": 'PASSPORT LAST NAME',
"txtFirstName": 'PASSPORT FIRST NAME',
"txtDob": 'yyyy-mm-dd',
"ddlCitizenship": 'COUNTRY', // CL == Chile
"txtEmailAddress": '[email protected]',
"txtEmailAddressConfirm": '[email protected]',
@ig10
ig10 / cepfill.js
Created October 7, 2014 23:25
CEPFillFromList
(function () {
function randomize(arr) {
return arr[Math.floor(Math.random() * (arr.length - 0))];
}
var cepList = ["69921722",
"69915848", "69918618", "69903034",
"69921749", "69900312", "69900309",
"69900214", "69918048", "69918012",
"69900270", "69900273", "69918060",
"69900259", "69917746", "69900092",
@ig10
ig10 / ig10_settings.json
Last active August 29, 2015 14:06
SBT2Cfg
{
"atomic_save": true,
"color_scheme": "Packages/Theme - Nil/Tubnil.tmTheme",
"draw_white_space": "all",
"font_face": "Monaco",
"font_size": 12.0,
"highlight_modified_tabs": true,
"ignored_packages":
[
"Vintage"
@ig10
ig10 / cpffill.js
Created August 18, 2014 23:44
CPFFillFromList
(function () {
function randomize(arr) {
return arr[Math.floor(Math.random() * (arr.length - 0))];
}
var cpfList = ["79722351800",
"08551583875",
"19072143051",
"12687174440",
"84077884659",
"26882180008",
@ig10
ig10 / ts3_sv_install.sh
Last active April 13, 2019 18:18
Install TeamSpeak 3 Server in Ubuntu Machine
#!/bin/bash
VERSION="3.3.0"
echo "-> Downloading TeamSpeak 3 Version $VERSION"
wget http://ftp.4players.de/pub/hosted/ts3/releases/$VERSION/teamspeak3-server_linux-amd64-$VERSION.tar.gz
echo "-> Decompressing Files... "
tar xzf teamspeak3-server_linux-amd64-$VERSION.tar.gz
@ig10
ig10 / OwnTabs.js
Created April 15, 2014 22:28
jQuery simple tabs
var Tabs = function(){
function init(){
$('.options > div > a').on('click', function(e){
e.preventDefault();
var $this = $(this);
if(!$this.hasClass('active')){
var activeTab = $('.active');
var activeElement = $(activeTab.attr('href'));
var triggeredElement = $($this.attr('href'));
@ig10
ig10 / excel_irr.rb
Last active August 29, 2015 13:57
Excel IRR function in Ruby
module I10
# Returns Internal Rate of Return (TIR Spanish) for a cash
# flow in numbers, with the payments as values.
# @param transactions : Array which contains initial project cost,
# and the payments over the time.
def I10.irr(transactions, max_iterations = 20)
min = 0.0
max = 1.0
npv = 0
iterations = 0
@ig10
ig10 / SBT2-custom-keys.sublime-keymap
Last active August 29, 2015 13:56
OsxCustomKeysSBT2
[
{ "keys": ["end"], "command": "move_to", "args": {"to": "eol", "extend": false} },
{ "keys": ["home"], "command": "move_to", "args": {"to": "bol", "extend": false} },
{ "keys": ["shift+home"], "command": "move_to", "args": {"to": "bol", "extend": true} },
{ "keys": ["shift+end"], "command": "move_to", "args": {"to": "eol", "extend": true} },
{ "keys": ["super+left"], "command": "move", "args": {"by": "subwords", "forward": false, "extend": false} },
{ "keys": ["super+right"], "command": "move", "args": {"by": "subword_ends", "forward": true, "extend": false} },
{ "keys": ["super+shift+left"], "command": "move", "args": {"by": "subwords", "forward": false, "extend": true} },
{ "keys": ["super+shift+right"], "command": "move", "args": {"by": "subword_ends", "forward": true, "extend": true} },
{ "keys": ["super+shift+up"], "command": "swap_line_up" },