Skip to content

Instantly share code, notes, and snippets.

View lucca65's full-sized avatar

Julien Lucca lucca65

View GitHub Profile
@lucca65
lucca65 / Rakefile
Last active October 5, 2017 00:42
Simple Rakefile to be used with Jekyll to easily generate new drafts for your blog. used on http://atomicbit.io/ruby/jekyll/2015/04/24/rakefile-for-new-posts-in-jekyll.html
require 'date'
desc 'Create a new draft post'
task :post do
STDOUT.puts('Whats the title of your post?')
title = STDIN.gets.chomp
if title.nil? || title.empty?
STDOUT.puts('No post name? Aborting...')
next
@lucca65
lucca65 / bitbucket-import.rb
Last active August 29, 2015 14:27 — forked from uri/bitbucket-import.rb
Import public repos from Bitbucket to Github
require 'httparty'
class Github
include HTTParty
base_uri "https://api.github.com"
BaseDirectory = "/Users/ugorelik/programming/repos"
def initialize(u, p)
@auth = { username: u, password: p}
load_bitbucket_repos
@lucca65
lucca65 / tiago_davi.exs
Created August 20, 2015 14:46
Gist fixing Tiago Davi code
defmodule Tax do
def get_tax_rates do
[ NC: 0.075, TX: 0.08 ]
end
def get_orders do
[
[ id: 123, ship_to: :NC, net_amount: 100.00 ],
[ id: 124, ship_to: :OK, net_amount: 35.50 ],
[ id: 125, ship_to: :TX, net_amount: 24.00 ],
[ id: 126, ship_to: :TX, net_amount: 44.80 ],
defmodule Test do
def create(conn, params) do
params
|> do_register # do business logic
|> format_response(conn) # create the message
|> render_json # just render it, simple, elegant
end
# toda funcao no elixir retorna alguma coisa, não existe `void`
defp do_register(params) do
(defun safadao ()
(interactive) ;; interactive interpreter
(let (birthdate) ;; create variable birthdate, it will be avaliable for nested stuff
(progn (setq birthdate (read-no-blanks-input "digite sua data de nascimento: "))) ;; set birthdate to whatever user inputs
(if (and (< 7 (length birthdate))
(> 9 (length birthdate)))
(let ((sum 0) list day month year safadeza)
(progn
(setq list (split-string birthdate "/"))
# encoding: UTF-8
require 'rubygems'
require 'csv'
require 'geocoder'
ips = CSV.read('ip.csv')
total = ips.length
decoded_ips = []

How to make money, in a simple way.

A) Goal

Your goal is to make $10k per month for 6 months so you can pay for higher education. Which can be broken down to a simpler make $350 per day, every day. So in 30 days you will make $10k. Which can be further broken down to selling something that will net you a profit of $350 per day.

Let's call this thing the product. 

/*
* DO NOT COMPILE AND RUN UNLESS YOU KNOW WHAT YOU ARE DOING.
* This is a 29 byte C code that compiles to a 17,179,875,837 byte (16 GB) executable.
* Author: Digital Trauma (codegolf.stackexchange.com/users/11259/digital-trauma)
* This defines the main function as a large array and initialises its first element.
* This causes GCC to store the entire array in the resulting executable.
* Because this array is bigger than 2GB,
* we need to provide the -mcmodel=medium flag to GCC.
* The extra 15 bytes are included in the score, as per the rules.
* Compile with:
@lucca65
lucca65 / word_list.exs
Created December 7, 2016 19:46
Word list problem Elixir implementation
defmodule WordFreq.Parser do
def work do
read_file
|> to_list
|> group
|> transform
|> Enum.take(10)
end
@doc """
@lucca65
lucca65 / client.exs
Last active December 7, 2016 19:55
Prime number simple cluster implementation
defmodule Worker do
def start do
pid = spawn(__MODULE__, :loop, [])
send(server_pid, {:request, pid})
pid
end
def server_pid do
:global.whereis_name("server")
end