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
# Add to ~/.profile or ~/.bashrc, etc | |
# Use it like: | |
# vm add ubuntu # or vm add ubuntu custom/ubuntu | |
# vm sh ubuntu | |
# <ctrl-x> to detach from shell | |
# vm sh ubuntu # returns to the same shell | |
# vm stop ubuntu && vm rm ubuntu | |
vm() { | |
case $1 in | |
ls) docker ps -a ;; |
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/sh | |
# A script to build a dynamic Nginx module with the correct configure options. | |
set -eu | |
set -o pipefail 2>/dev/null || : | |
dir="$1" | |
if [ ! "$dir" ]; then |
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/sh | |
# Functions to escape strings for use in utilities like grep, sed and ex | |
# Examples | |
# grep "$(bre "$foo")" file | |
# sed "s/$(ptrn "$foo")/$(repl "$bar")/g" file | |
# echo "s/$(exptrn "$foo")/$(exrepl "$bar")/g | %p | q" | ex file | |
bre() { |
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/sh | |
username=$1 | |
if [ ! "$username" ]; then | |
echo usage: $0 username >&2 | |
exit 1 | |
fi | |
if [ "`id -u`" != 0 ]; then |
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
/* | |
* Copyright (c) 2018, Salvatore Sanfilippo <antirez at gmail dot com> | |
* All rights reserved. | |
* | |
* Redistribution and use in source and binary forms, with or without | |
* modification, are permitted provided that the following conditions are met: | |
* | |
* * Redistributions of source code must retain the above copyright notice, | |
* this list of conditions and the following disclaimer. | |
* * Redistributions in binary form must reproduce the above copyright |
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
#include <stdlib.h> | |
#include <time.h> | |
#include <windows.h> | |
#define WIDTH 80 | |
#define HEIGHT 40 | |
#define idx(x, y) ((x)+WIDTH*(y)) |
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
"""This module sorts a list of results based on a query. | |
If there is an intersection between words in the query and a result, it | |
is placed near the beginning of the list (based on length of intersection). | |
If there is no intersection, the position of the query (substring) in the | |
result (string) is used for sorting. These results are placed toward the end | |
of the list. | |
""" |
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
"""A command line version of Minesweeper""" | |
import random | |
import re | |
import time | |
from string import ascii_lowercase | |
def setupgrid(gridsize, start, numberofmines): | |
emptygrid = [['0' for i in range(gridsize)] for i in range(gridsize)] |
NewerOlder