From Bas van Dijk:
To understand these things I would recommend using nix-repl:
$ nix-repl
Welcome to Nix version 1.11.2. Type :? for help.
#!/bin/env python | |
import os | |
import json | |
import hashlib | |
from functools import reduce | |
import argparse | |
import logging | |
import shutil | |
DOCKER_DIR = '/var/lib/docker' |
package math | |
import "testing" | |
func setupTestCase(t *testing.T) func(t *testing.T) { | |
t.Log("setup test case") | |
return func(t *testing.T) { | |
t.Log("teardown test case") | |
} | |
} |
# Install deltarpm to reduce the size of download | |
yum install -y deltarpm \ | |
&& yum install -y python-pip \ | |
&& pip install --upgrade pip | |
# Scrapy Pre-Requisites | |
yum install -y gcc libffi-devel python-devel openssl-devel | |
yum install -y libxslt-devel libxml++-devel libxml2-devel | |
pip install lxml incremental |
package main | |
import ( | |
"fmt" | |
"github.com/julienschmidt/httprouter" | |
"log" | |
"net/http" | |
) | |
// The type of our middleware consists of the original handler we want to wrap and a message |
// openBrowser tries to open the URL in a browser, | |
// and returns whether it succeed in doing so. | |
func openBrowser(url string) bool { | |
var args []string | |
switch runtime.GOOS { | |
case "darwin": | |
args = []string{"open"} | |
case "windows": | |
args = []string{"cmd", "/c", "start"} | |
default: |
package main | |
import( | |
"fmt" | |
"time" | |
) | |
func NumberOfTheWeekInMonth(now time.Time) int { | |
beginningOfTheMonth := time.Date(now.Year(), now.Month(), 1, 1, 1, 1, 1, time.UTC) | |
_, thisWeek := now.ISOWeek() |
set listchars=tab:→\ ,trail:␣,extends:…,eol:⏎ | |
set listchars=tab:→\ ,trail:␣,precedes:«,extends:»,eol:⏎ | |
set listchars=tab:→\ ,trail:·,precedes:«,extends:»,eol:¶ | |
set listchars=tab:‣\ ,trail:·,precedes:«,extends:»,eol:¬ | |
set listchars=tab:␋\ ,trail:␠,precedes:«,extends:»,eol: | |
set listchars=tab:>-,trail:.,precedes:<,extends:>,eol:$ |
""" | |
Convert a MongoDB ObjectID to a version-1 UUID. | |
Python 2.7+ required for datetime.timedelta.total_seconds(). | |
ObjectID: | |
- UNIX timestamp (32 bits) | |
- Machine identifier (24 bits) | |
- Process ID (16 bits) | |
- Counter (24 bits) |