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 | |
#replace /var/state and /var/state/mongodb with your proper path | |
sudo rm /var/state/mongodb/mongod.lock | |
sudo -u mongodb mongod --repair --dbpath=/var/state/mongodb | |
sudo /etc/rc.d/mongodb restart |
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
var janitor = new Image(), | |
info = {}, | |
test = $("#test"), | |
images = []; | |
$.get("somewhere_that_fetch_the_page").complete(function (data) { | |
var tmpImages = $(data.responseText).find("img"); | |
tmpImages.each(function (key, img) { | |
var src = (img.getAttribute ? img.getAttribute("src") : false) || img.src; |
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
""" | |
Webasset filter to combine JQuery Templates files into javascript-safe strings, | |
and put them into a namespace | |
""" | |
import os | |
from webassets.filter import Filter | |
class JqtFilter(Filter): | |
name = 'jqt' |
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 | |
mongo_path=/var/lib/mongodb | |
sudo rm $mongo_path/mongod.lock | |
sudo -u mongodb mongod --repair --dbpath=$mongo_path | |
sudo /etc/init.d/mongodb restart |
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
def word_wrap(input, width): | |
input = input.strip() | |
if not input: | |
return "" | |
if len(input) < width: | |
return input | |
i = input.find(" ", width) | |
if i < 0: | |
return input[:width] + "\n" + word_wrap(input[width:], width) |
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
#!/usr/bin/env ruby | |
def get_time(format="%H:%M") | |
Time.now.strftime("%H:%M") | |
end | |
case get_time | |
when "09:00" | |
`say you should finish your breakfast in 10 minutes` | |
when "11:55" |
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
$ | |
:$$ | |
seeee$$$Neeee | |
R$$$F$$$$F | |
$$$$$$ | |
@$$P*$$B | |
z$#" $#$b | |
" d 'N " | |
@" ?r | |
xF . "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
require "rspec/core/formatters/progress_formatter" | |
class ApplauseFormatter < RSpec::Core::Formatters::ProgressFormatter | |
def initialize(output) | |
super(output) | |
unless File.exists? "/tmp/applause.mp3" | |
p "Downloading applause for awesomeness" | |
system "wget http://www.soundjay.com/human/applause-1.mp3 -O /tmp/applause.mp3" | |
end | |
end |
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
pkill docker | |
iptables -t nat -F | |
ifconfig docker0 down | |
brctl delbr docker0 | |
docker -d |
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
10.143.7.175 - - [02/Sep/2013:04:08:22 +0000] "GET /v1/_ping HTTP/1.1" 200 4 "-" "Go 1.1 package http" "-" | |
10.143.7.175 - - [02/Sep/2013:04:08:32 +0000] "POST /v1/users/ HTTP/1.1" 201 14 "-" "Go 1.1 package http" "-" | |
10.143.7.175 - - [02/Sep/2013:04:08:32 +0000] "GET /v1/_ping HTTP/1.1" 200 4 "-" "Go 1.1 package http" "-" | |
10.143.7.175 - docker [02/Sep/2013:04:08:32 +0000] "PUT /v1/repositories/test/essential/ HTTP/1.1" 200 2 "-" "go/go1.1.1 kernel/3.8.0-29-generic" "-" | |
10.143.7.175 - - [02/Sep/2013:04:08:32 +0000] "GET /v1/images/8dbd9e392a964056420e5d58ca5cc376ef18e2de93b5cc90e868a1bbc8318c1c/json HTTP/1.1" 401 194 "-" "go/go1.1.1 kernel/3.8.0-29-generic" "-" | |
10.143.7.175 - - [02/Sep/2013:04:08:32 +0000] "PUT /v1/images/8dbd9e392a964056420e5d58ca5cc376ef18e2de93b5cc90e868a1bbc8318c1c/json HTTP/1.1" 401 194 "-" "go/go1.1.1 kernel/3.8.0-29-generic" "-" |
OlderNewer