Skip to content

Instantly share code, notes, and snippets.

@douglascamata
douglascamata / install_ruby_rpi.sh
Created Apr 3, 2018 — forked from blacktm/install_ruby_rpi.sh
A Bash script to install Ruby 2.5 on the Raspberry Pi (Raspbian)
View install_ruby_rpi.sh
#!/bin/bash
# --------------------------------------------------------------------------------------------
# Installs Ruby 2.5 using rbenv/ruby-build on the Raspberry Pi (Raspbian)
#
# Run from the web:
# bash <(curl -s https://gist.githubusercontent.com/blacktm/8302741/raw/install_ruby_rpi.sh)
# --------------------------------------------------------------------------------------------
# Welcome message
View keybase.md

Keybase proof

I hereby claim:

  • I am douglascamata on github.
  • I am douglascamata (https://keybase.io/douglascamata) on keybase.
  • I have a public key ASDMEt8fIWbzvdVJDYSHFZu8AbrLlwYq-mRsfM3lihWxrgo

To claim this, I am signing this object:

View gist:60be9ed13634c774c4be
Verifying that +douglascamata is my blockchain ID. https://onename.com/douglascamata
View fish_prompt.fish
# name: Numist
function fish_prompt
set -l last_status $status
# Colours
set -l cyan (set_color -o cyan)
set -l yellow (set_color -o yellow)
set -l green (set_color -o green)
set -l red (set_color -o red)
set -l blue (set_color -o blue)
View codigo.py
if not isinstance(processing_result, list):
processing_result = [processing_result]
for user_attribute in processing_result:
if user_attribute is not None:
print "INDEXING user_attribute = '%s'" % user_attribute
self.es_conn.index("user", module["index_name"], user_attribute, id=attribute_id)
@douglascamata
douglascamata / death_of_ifs.rb
Last active Dec 16, 2015
Another solution to this post (http://jumpstartlab.com/news/archives/2013/04/23/the-death-of-ifs) with objects that can do real stuff, like Twitter (or any other social network, i.e.) API calls.
View death_of_ifs.rb
def start
command = ""
command_processor = CommandProcessor.new
command_processor.add_command('follow', Proc.new { puts 'do some stuff' })
while command != "q"
printf "enter command: "
command = gets.chomp
command_processor.process(command)
end
end
View death_of_ifs.rb
def start
command = ""
command_processor = CommandProcessor.new
command_processor.add_command('follow', 'following')
while command != "q"
printf "enter command: "
command = gets.chomp
command_processor.process(command)
end
end
@douglascamata
douglascamata / death_of_ifs.rb
Created Apr 26, 2013
Another solution to this post (http://jumpstartlab.com/news/archives/2013/04/23/the-death-of-ifs) problem: use Ruby Not using objects.
View death_of_ifs.rb
def start
command = ""
commands = default_commands
add_command(commands, "follow", "following")
while command != "q"
printf "enter command: "
command = gets.chomp
process(command, commands)
end
end
View refactored_score.rb
def calculate
bet_scores_per_type = {
winner_fighter_id: { @result[:winner_fighter_id] => 10 },
fight_victory_type_id: { @result[:fight_victory_type_id] => 30},
round: { @result[:details][:round] => 50}
}
user_bets_per_type = {
winner_fighter_id: @betting[:bet_fighter_id],
fight_victory_type_id: @betting[:fight_victory_type_id]
View http.py
def get(self):
key = self._load_request_as_json().get('key')
is_metadata_request = self._load_request_as_json().get('metadata')
response = self.sam.get(key=key).resource()
if hasattr(response.data, 'metadata_key'):
if is_metadata_request:
response = cyclone.web.escape.json_encode({'metadata_key':response.data.metadata_key})
elif response.data.metadata_key:
response = cyclone.web.escape.json_encode({'done':True})
You can’t perform that action at this time.