Skip to content

Instantly share code, notes, and snippets.

View dqminh's full-sized avatar

Daniel, Dao Quang Minh dqminh

View GitHub Profile
@dqminh
dqminh / christmas.tree
Created December 5, 2011 04:58
We want this tree
$
:$$
seeee$$$Neeee
R$$$F$$$$F
$$$$$$
@$$P*$$B
z$#" $#$b
" d 'N "
@" ?r
xF . "N
#!/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"
@dqminh
dqminh / wordwrap.py
Created June 28, 2011 03:48
basic word wrap
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)
@dqminh
dqminh / gist:1029041
Created June 16, 2011 10:55
mongodb-restart
#!/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
@dqminh
dqminh / jqtfilter.py
Created May 25, 2011 07:04
JS template filter for webassets
"""
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'
@dqminh
dqminh / gist:964135
Created May 10, 2011 09:02
fetch_image.js
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;
#!/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
package main
import (
"log"
"os"
"os/exec"
"time"
)
func main() {
diff --git a/vendor/src/github.com/docker/libcontainer/process_linux.go b/vendor/src/github.com/docker/libcontainer/process_linux.go
index 1c74b65..fc9a733 100644
--- a/vendor/src/github.com/docker/libcontainer/process_linux.go
+++ b/vendor/src/github.com/docker/libcontainer/process_linux.go
@@ -127,12 +127,13 @@ func (p *setnsProcess) terminate() error {
}
func (p *setnsProcess) wait() (*os.ProcessState, error) {
- err := p.cmd.Wait()
- if err != nil {
+
+func TestExecinPassExtraFiles(t *testing.T) {
+ if testing.Short() {
+ return
+ }
+ rootfs, err := newRootfs()
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer remove(rootfs)