This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import serial | |
import time | |
import sys | |
import serial.tools.list_ports | |
ports = serial.tools.list_ports.comports() | |
print("Current serial ports:\n") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function kns | |
echo $argv | read -l namespace context | |
if test -z "$context" | |
set context (kubectl config current-context) | |
end | |
if test -z "$argv" | |
echo "USAGE: kns NAMESPACE [context]" | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# This script provides a quick build alternative: | |
# * Dependencies are downloaded and built automatically | |
# * kafkacat is built automatically. | |
# * kafkacat is linked statically to avoid runtime dependencies. | |
# | |
# While this might not be the preferred method of building kafkacat, it | |
# is the easiest and quickest way. | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'webrick' | |
server = WEBrick::HTTPServer.new(Port: 1234) | |
server.mount_proc('/') { |req, res| IO.popen('pbcopy', 'w') { |io| io.write(req.body) } } | |
server.start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$LOAD_PATH.unshift('./lib/') | |
require 'jwt' | |
require 'benchmark/ips' | |
@private_key = {} | |
@public_key = {} | |
@jwt = {} | |
@payload = { :hello => 'world' } | |
def init_jwt(type, key_type) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'formula' | |
class Icmake < Formula | |
url 'http://downloads.sourceforge.net/project/icmake/icmake/7.21.00/icmake_7.21.00.orig.tar.gz' | |
homepage 'http://icmake.sourceforge.net/' | |
sha1 '57e9a00963fbca1f9a3535b2b3cc5692f9799b5b' | |
depends_on 'gnu-sed' | |
def patches |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$widths = {1 => 68.28515625, | |
2 => 35, | |
3 => 112.7109375, | |
4 => 57.140625, | |
5 => 134.85546875, | |
6 => 68.28515625, | |
7 => 157, | |
8 => 79.42578125, | |
9 => 157, | |
10 => 79.42578125, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'open-uri' | |
require 'rubocop' | |
require 'tmpdir' | |
url = 'https://raw.github.com/bbatsov/ruby-style-guide/master/README.md' | |
data = open(url).read | |
code_blocks = data.scan(/```ruby[\r\n]+(.*?)```/mi) | |
puts "Found #{code_blocks.length} code blocks" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Routes loaded, stack: | |
/usr/local/Cellar/ruby/2.0.0-p0/lib/ruby/gems/2.0.0/gems/actionpack-3.2.13/lib/action_dispatch/routing/mapper.rb:420:in `instance_exec' | |
/usr/local/Cellar/ruby/2.0.0-p0/lib/ruby/gems/2.0.0/gems/actionpack-3.2.13/lib/action_dispatch/routing/mapper.rb:420:in `block in with_default_scope' | |
/usr/local/Cellar/ruby/2.0.0-p0/lib/ruby/gems/2.0.0/gems/actionpack-3.2.13/lib/action_dispatch/routing/mapper.rb:618:in `scope' | |
/usr/local/Cellar/ruby/2.0.0-p0/lib/ruby/gems/2.0.0/gems/actionpack-3.2.13/lib/action_dispatch/routing/mapper.rb:419:in `with_default_scope' | |
/usr/local/Cellar/ruby/2.0.0-p0/lib/ruby/gems/2.0.0/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:287:in `eval_block' | |
/usr/local/Cellar/ruby/2.0.0-p0/lib/ruby/gems/2.0.0/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:295:in `block in finalize!' | |
/usr/local/Cellar/ruby/2.0.0-p0/lib/ruby/gems/2.0.0/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:295:in `each' | |
/usr/local/Cellar/ruby/2.0.0-p0/lib/r |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Inspired by http://bit.ly/juSAWl | |
// Augment String.prototype to allow for easier formatting. This implementation | |
// doesn't completely destroy any existing String.prototype.format functions, | |
// and will stringify objects/arrays. | |
String.prototype.format = function(i, safe, arg) { | |
function format() { | |
var str = this, len = arguments.length+1; | |
// For each {0} {1} {n...} replace with the argument in that position. If |
NewerOlder