Skip to content

Instantly share code, notes, and snippets.

View jorge-d's full-sized avatar
🚀

Dimitri Cabete Jorge jorge-d

🚀
View GitHub Profile
@jorge-d
jorge-d / clean_launchctl.sh
Last active April 26, 2020 00:04
Clean launchctl agents
# list the possibly-unwanted jobs
launchctl list | grep -v apple | grep -v homebrew
# find the agents path
launchctl dumpstate | grep -v apple | grep -v homebrew | grep plist
# unload the job
launchctl unload -w /path/to/the_file.plist
@jorge-d
jorge-d / loto.rb
Last active January 31, 2023 12:57
Lottery numbers generator (5*[1-49] + [1-10])
def gen(nb, max)
pool = (1..max).to_a
nb.times.map { pool.shuffle!.pop }.sort
end
# LOTO
numbers = gen(5, 49) + gen(1, 10)
puts "Draw: #{numbers.slice(0..-2).join(" - ")} | #{numbers.last}"
# Euromillion
@jorge-d
jorge-d / ARC
Last active December 4, 2017 23:15 — forked from gabriel-dehan/ARC
Setup a masternode for ArcticCoin; For now the wallet we use is the server's, but next version will change that; Also you should encrypt your wallet on real conditions :)
# FROM ubuntu:16.04
apt-get update
apt-get install -y build-essential software-properties-common autoconf libssl-dev libboost-dev libboost-chrono-dev libboost-filesystem-dev libboost-program-options-dev libboost-system-dev libboost-test-dev libboost-thread-dev sudo automake git
add-apt-repository ppa:bitcoin/bitcoin -y
apt-get update
apt-get install libdb4.8-dev bsdmainutils libdb4.8++-dev -y
mkdir ~/arc
cd ~/arc
apt-get install wget nano -y
@jorge-d
jorge-d / probe.js
Last active August 29, 2015 14:16 — forked from Unitech/probe.js
var metric = probe.metric({
name : 'Realtime user',
agg_type: 'avg', // 'sum' / 'avg' / 'min' / 'max'
value : function() {
return Object.keys(users).length;
}
});
[
{
"created_at":"Fri Oct 03 2014 13:01:27 GMT+00:00",
"data":{
"active":false,
"process":[
{
"axm_actions":[
],
@jorge-d
jorge-d / hash_table.rb
Last active August 29, 2015 14:00
This is a ruby implementation of HashTable. It implements two ways of handling collisions, with arrays and Binary Trees. There is also a benchmark of the two different methods (On Insertion and Search). I've done this after reading the sample exercise in http://codingforinterviews.com
# For this week, take a stab at implementing a hash table in your favorite
# programming language. That is to say, write a data structure that
# will let you map keys
# to values and give you amortized constant-time access.
# Your implementation should have some form of collision handling--what do
# you do when your hash function maps two keys to the same place?
# This is a game of taboo—don't use any associative arrays
# (dictionaries, hash.*s, {}s, PHP array(k=>v)s etc) in your implementation.
# Time yourself, and time box your attempt to one hour.
# As Yegge notes: "You should be able to implement one using only arrays in