Skip to content

Instantly share code, notes, and snippets.

View FrancoB411's full-sized avatar

Franco Barbeite FrancoB411

View GitHub Profile
@FrancoB411
FrancoB411 / ets.exs
Last active March 15, 2023 18:25 — forked from Miserlou/ets.exs
ets.exs
# Create a new table called `globals
:ets.new(:globals, [:named_table, :public])
# Put some data in it
:ets.insert(:globals, {:are_we_crunching, true})
# Get it back
:ets.lookup(:globals, :are_we_crunching) # true
#include <cs50.h>
#include <stdio.h>
#include <math.h>
#include <stdbool.h>
int last_digit(long num);
bool ends_with_zero(int num);
bool is_even(int num);
bool luhn_validate(long num);
int first_n_digits(long num, int len, int n);
We can't make this file beautiful and searchable because it's too large.
unique_mos_id,first_name,last_name,command_now,complaint_id,month_received,year_received,month_closed,year_closed,command_at_incident,rank_abbrev_incident,rank_abbrev_now,rank_now,rank_incident,mos_ethnicity,mos_gender,mos_age_incident,complainant_ethnicity,complainant_gender,complainant_age_incident,fado_type,allegation,precinct,contact_reason,outcome_description,board_disposition
10004,Jonathan,Ruiz,078 PCT,42835,7,2019,5,2020,078 PCT,POM,POM,Police Officer,Police Officer,Hispanic,M,32,Black,Female,38,Abuse of Authority,Failure to provide RTKA card,78,Report-domestic dispute,No arrest made or summons issued,Substantiated (Command Lvl Instructions)
10007,John,Sears,078 PCT,24601,11,2011,8,2012,PBBS,POM,POM,Police Officer,Police Officer,White,M,24,Black,Male,26,Discourtesy,Action,67,Moving violation,Moving violation summons issued,Substantiated (Charges)
10007,John,Sears,078 PCT,24601,11,2011,8,2012,PBBS,POM,POM,Police Officer,Police Officer,White,M,24,Black,Male,26,Offensive Language,Race,67,Moving violation
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
(setq-default
;; Base distribution to use. This is a layer contained in the directory
@FrancoB411
FrancoB411 / ohms_regexp.py
Created October 1, 2019 00:32
ohms regex
import re
re_string = "(\d+\.\d+|\d+|)(\D*)\s(ohms)"
inputs = [
"10 ohms",
"100 ohms",
"220 ohms",
"330 ohms",
"470 ohms",
@FrancoB411
FrancoB411 / calculator_service.rb
Last active June 8, 2018 16:59
Refactored to have a cleaner API, so users can calculate without explicitly newing up the class.
class Calculator
ORDERED_OPERATIONS = %W(* / + -) # maintainable, add new operations easily
# no need to new up if you don't want to.
def self.calculate(input)
new.calculate(input)
end
# There is a pathological case where unknown operators are entered.
@FrancoB411
FrancoB411 / calculator_refactor_1.rb
Last active June 8, 2018 15:49
Some refactors to reduce the API surface area, make operations dryer and more maintainable, better naming
class Calculator
ORDERED_OPERATIONS = %W(* / + -)
def calculate(input)
input = input.split(" ")
while input.length > 1 do
ORDERED_OPERATIONS.each do | op |
i = input.find_index(op)
class Calculator
def parse input
input.split(" ")
end
def order_of_operations
["*", "/", "+", "-"]
end
class Calculator
def parse input
input.split(" ")
end
def order_of_operations
["*", "/", "+", "-"]
end
@FrancoB411
FrancoB411 / tmux-cheatsheet.markdown
Created June 1, 2018 15:08 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname