Skip to content

Instantly share code, notes, and snippets.

Avatar

Mark Morris blurredbits

View GitHub Profile
View memmap.txt
Type Start End # Pages Attributes
Available 0000000000000000-000000000009EFFF 000000000000009F 000000000000000F
Reserved 000000000009F000-000000000009FFFF 0000000000000001 000000000000000F
Available 0000000000100000-000000001DF0DFFF 000000000001DE0E 000000000000000F
BS_Data 000000001DF0E000-000000001DF4DFFF 0000000000000040 000000000000000F
Available 000000001DF4E000-0000000033FAFFFF 0000000000016062 000000000000000F
LoaderCode 0000000033FB0000-00000000340D4FFF 0000000000000125 000000000000000F
BS_Data 00000000340D5000-0000000035DEFFFF 0000000000001D1B 000000000000000F
ACPI_NVS 0000000035DF0000-0000000035DF0FFF 0000000000000001 000000000000000F
RT_Data 0000000035DF1000-0000000035DF1FFF 0000000000000001 800000000000000F
View craftingcode.md

Crafting Code

Here's the thing. Computers are nothing more than really fast light switches. On & off millions of times per second. All it cares about is ones & zeroes.

So when it comes to code, and more specifically crafting code, who are we really writing code for?

We're writing it for ourselves, our teammates or our customers - basically other humans. We're using code to express ideas, human ideas in terms of a computer language. As developers, we're tasked with creating sets of instructions to be carried out by our dumb servants to execute these ideas.

If the computer doesn't particularly care about code (other than a clean compile) - what are some of the tools we can use to craft our code for human consumption?

@blurredbits
blurredbits / statsd_timer_example.rb
Created Jul 31, 2015
Sample for code for StatsD Timer
View statsd_timer_example.rb
require 'statsd-ruby'
statsd = Statsd.new('localhost', 8125)
# Single call to statsd timer.
statsd.time("timer_data") do
timer_data = 1 + Random.rand(6)
puts timer_data
sleep timer_data
end
@blurredbits
blurredbits / docker_commands
Last active Aug 29, 2015
Kafka Docker Commands
View docker_commands
docker run -d \
--name zookeeper \
--publish 2181:2181 \
jplock/zookeeper:3.4.6
docker run -d \
--name kafka \
--link zookeeper:zookeeper \
--publish 9092:9092 --publish 7203:7203 \
--env EXPOSED_HOST=127.0.0.1 --env ZOOKEEPER_IP=127.0.0.1 \
@blurredbits
blurredbits / mongo_consumer.rb
Last active Aug 29, 2015
Kafka Mongo Consumer
View mongo_consumer.rb
#!/usr/bin/env ruby
require 'poseidon'
require 'mongo'
Mongo::Logger.logger.level = Logger::WARN
db = Mongo::Client.new(['127.0.0.1:27017'], database: 'metrics')
consumer = Poseidon::PartitionConsumer.new("mongo_consumer", "localhost", 9092, "metrics", 0, :earliest_offset)
@blurredbits
blurredbits / pg_consumer.rb
Last active May 17, 2018
Kafka PostgreSQL Consumer
View pg_consumer.rb
#!/usr/bin/env ruby
require 'poseidon'
require 'pg'
conn = PG.connect(host: 'localhost', port: 5432, dbname: 'postgres', user: 'postgres')
begin
conn.exec("CREATE DATABASE metrics")
rescue PG::DuplicateDatabase
@blurredbits
blurredbits / producer.rb
Created Jun 30, 2015
Kafka Producer Example
View producer.rb
#!/usr/bin/env ruby
require 'poseidon'
producer = Poseidon::Producer.new(["localhost:9092"], "test_producer")
loop do
messages = []
messages << Poseidon::MessageToSend.new("metrics", "timestamp: #{Time.now.to_i}, metric: #{rand(10..30)}")
producer.send_messages(messages)
View container_monitor.rb
#!/usr/bin/env ruby
require 'excon'
require 'statsd-ruby'
require 'json'
module ExconConnection
class << self
View keybase.md

Keybase proof

I hereby claim:

  • I am blurredbits on github.
  • I am blurredbits (https://keybase.io/blurredbits) on keybase.
  • I have a public key whose fingerprint is E089 8BC5 353D 1E11 4AFB DF15 AE8B 21F9 6723 91E2

To claim this, I am signing this object:

View student.js
validate('first_name', 'email', 'dream', 'password', 'password_confirm', function(value) {
if (this.is_empty(value)) {
return "Cannot be empty";
}
return true;
})
validate('form', function(elements) {
if (elements['first_name'].value == elements['last_name'].value) {
You can’t perform that action at this time.