Skip to content

Instantly share code, notes, and snippets.

@lamont-granquist
lamont-granquist / resources.md
Last active August 17, 2023 22:29
Three Ways to Write Correct Chef Resources

This has been moved into the official Chef docs:

https://docs.chef.io/custom_resources_notes.html

12.5 style custom resources

This is by far the most recommended way of writing resources for all users. There are two gotchas which we're working through:

  1. For helper functions that you used to write in your provider code or used to mixin to your provider code, you have to use an action_class do ... end block.
e24a5c8f584c38001ead4767a5cc352a
@cattywampus
cattywampus / flag.rb
Last active March 3, 2016 19:50
A colored and animated American flag in Ruby
#!/usr/bin/env ruby
def red(string)
"\e[37;41m#{string}\e[0m"
end
def white(string)
"\e[30;47m#{string}\e[0m"
end
@galenemery
galenemery / Winrm_setup.ps1
Last active February 9, 2020 05:24
WinRM config
# On the remote node/server:
winrm quickconfig -q
winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="300"}'
winrm set winrm/config '@{MaxTimeoutms="1800000"}'
# When NOT USING a domain-based authentication (i.e., from Linux/Unix to Windows node):
winrm set winrm/config/service/auth '@{Basic="true"}'
@karledurante
karledurante / gist:6215387
Created August 12, 2013 21:19
RubyLoco Hack Night: Sphero!
require 'sphero'
require 'pry'
FORWARD = 0
RIGHT = 90
BACKWARD = 180
LEFT = 270
SLOW = 100
FAST = 200
@ashrithr
ashrithr / kafka.md
Last active March 14, 2024 21:16
kafka introduction

Introduction to Kafka

Kafka acts as a kind of write-ahead log (WAL) that records messages to a persistent store (disk) and allows subscribers to read and apply these changes to their own stores in a system appropriate time-frame.

Terminology:

  • Producers send messages to brokers
  • Consumers read messages from brokers
  • Messages are sent to a topic
@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@mnylen
mnylen / OS X Snow Leopard
Created January 5, 2011 13:21
How to get RVM + Subversion Ruby Bindings to work
$ rvm use 1.8.7-p302
$ wget http://subversion.tigris.org/downloads/subversion-1.6.15.tar.gz
$ tar -xzf subversion-1.6.15.tar.gz && cd subversion-1.6.15
$ ./configure --with-ruby-sitedir=~/.rvm/rubies/ruby-1.8.7-p302/lib/ruby --without-berkeley-db
$ make swig-rb && make install-swig-rb
To test things out:
$ irb
ruby-1.8.7-p302 > require 'svn/client'
=> true