Skip to content

Instantly share code, notes, and snippets.

@directionless
directionless / which-month.rb
Created Jan 19, 2011
Which month is best? Ask google
View which-month.rb
#!/usr/bin/env ruby
require "rubygems"
View gist:1243340
seph@mia-in-poll-3:~$ sudo -u nobody -s
nobody@mia-in-poll-3:~$ env
SHELL=/bin/bash
TERM=xterm
USER=nobody
SUDO_USER=seph
SUDO_UID=2001
SSH_AUTH_SOCK=/tmp/ssh-YNywjT1156/agent.1156
USERNAME=nobody
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin
@directionless
directionless / gist:1933823
Created Feb 28, 2012
boot complication errors
View gist:1933823
# Still trying to get this compiled. I don't think -isystem helps. (boost is in /usr/local/include) same error with g++ as with llvm
whittemore:frontend seph$ g++ -DHAVE_CONFIG_H -I. -I../.. -I./../statesync -I./../terminal -I./../network -I./../crypto -I./../protobufs -I./../util -isystem /usr/local/include -pedantic -Wno-long-long -Werror -Wall -Wextra -Weffc++ -fno-default-inline -pipe -D_THREAD_SAFE -isystem /usr/local/Cellar/protobuf/2.4.1/include -g -O2 -MT terminaloverlay.o -MD -MP -MF .deps/terminaloverlay.Tpo -c -o terminaloverlay.o terminaloverlay.cc
cc1plus: warnings being treated as errors
/usr/local/include/boost/lambda/detail/operators.hpp: In member function ‘Overlay::Validity Overlay::ConditionalOverlayCell::get_validity(const Terminal::Framebuffer&, int, uint64_t, uint64_t) const’:
/usr/local/include/boost/lambda/detail/operators.hpp:119: warning: user-defined ‘const boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::logical_action<boost::lambda::and_action>,
View gist:1934869
export PATH="/Users/seph/homebrew/bin:$PATH"
tar xzf /Users/seph/mosh-0.96a.tar.gz
cd mosh-0.96a
./configure --prefix=/tmp/mosh --with-boost=/Users/seph/homebrew/
make
View gist:1935587
git whittemore:tmp seph$ git clone https://github.com/andersk/mosh.git
Cloning into mosh...
remote: Counting objects: 2305, done.
remote: Compressing objects: 100% (713/713), done.
remote: Total 2305 (delta 1627), reused 2247 (delta 1571)
Receiving objects: 100% (2305/2305), 504.41 KiB | 517 KiB/s, done.
Resolving deltas: 100% (1627/1627), done.
whittemore:tmp seph$ cd mosh/
whittemore:mosh seph$ git checkout macosx
Branch macosx set up to track remote branch macosx from origin.
@directionless
directionless / gist:3866649
Created Oct 10, 2012
cpu use test script
View gist:3866649
#!/usr/bin/env ruby
# we're seeing some odd slowdown on hosts. It kind of looks like the
# host is pausing for some number of milliseconds, which hits the
# various ruby processes. It would be nice if we understood what was
# happening. This is a small script to help understand it.
# theory:
# Do work that takes about N
# Measure elapsed time M
@directionless
directionless / gist:4090745
Created Nov 16, 2012
merge asset directories
View gist:4090745
def symlink_r(source, dest)
# recursively symlinks a directory tree.
# skips files that already exist.
::Dir.glob(::File.join(source, "**", "*")).each do |f|
next if ::File.directory?(f)
new_name = ::File.join(dest, f.gsub(/^#{source}/, "") )
next if ::File.exists?(new_name) or ::File.symlink?(new_name)
::FileUtils.mkdir_p(::File.dirname(new_name))
#puts "trying #{f} => #{new_name}"
::File.symlink(f, new_name)
@directionless
directionless / gist:5057589
Last active Dec 14, 2015
mongodb sub document trouble
View gist:5057589
db.foo.insert( {_id: 1}, { "$set": {param: "one" }} )
db.foo.update(
{
"_id": 1,
"sub._id": 2
},
{ $set: { "sub.$": {
"param": 2,
"place": "Boston"
@directionless
directionless / 1 set
Last active Dec 14, 2015
chef -- create an ssh key and store it in the attributes
View 1 set
# Create the ssh access key
#
# Something in the node.set lines happens at the *start* of the chef
# run. It might be the node.set, or it might be the File.read, but
# either way, it happens before the resource execution. To compensate
# for this, we need to shift the ssh key creation to the start of the
# run. http://docs.opscode.com/resource_common_compile.html
sshfile = "/home/runtime/id_rsa"
sshcomment = [
View library.rb
class Chef::Recipe
def find_nrpe_plugin(name)
return name if name.start_with?("/")
end
end