Skip to content

Instantly share code, notes, and snippets.

In [1]: from pathlib import Path
In [2]: from codecs import encode
In [3]: words = set(Path('/usr/share/dict/words').read_text().splitlines())
In [4]: rot13 = set(encode(w, 'rot13') for w in words)
In [5]: [(w, encode(w, 'rot13')) for w in (words & rot13) if len(w) >= 3]
Out[5]:
# 'make' doesn't need a makefile to compile basic C programs
$ make shr && ./shr | grep 'Vm\|\[\|Rss'
[P] Parent, pre munmap
VmPeak: 23708 kB
VmSize: 23708 kB
VmLck: 0 kB
VmPin: 0 kB
VmHWM: 20656 kB
VmRSS: 20656 kB
RssAnon: 88 kB
#include <efi.h>
#include <efilib.h>
#define EFI_TRY(X) \
status = X; \
if (EFI_ERROR(status)) { \
Print(L"Error on line %d (%s): %r", __LINE__, L ## #X, status); \
goto cleanup; \
}
diff --git a/palaver.cpp b/palaver.cpp
--- a/palaver.cpp
+++ b/palaver.cpp
@@ -64,10 +66,12 @@ CString re_escape(const CString& sString) {
typedef enum {
- StatusLine = 0,
- Headers = 1,
- Body = 2,
import Math.Combinat.Sets (sublists)
topPops :: [Int]
topPops = [ 18897109, 12828837, 9461105, 6371773, 5965343, 5946800, 5582170, 5564635, 5268860, 4552402, 4335391, 4296250, 4224851, 4192887, 3439809, 3279833, 3095313, 2812896, 2783243, 2710489, 2543482, 2356285, 2226009, 2149127, 2142508, 2134411 ]
target :: Int
target = 100000000
sols :: [[Int]]
sols = filter ((== target) . sum) $ sublists topPops
#!/usr/bin/python
import sqlite3
import struct
import sys
def main():
conn = sqlite3.connect(sys.argv[1])
conn.row_factory = sqlite3.Row
c = conn.cursor()
for row in c.execute('SELECT * FROM cbb_msg'):
#!/usr/bin/env python
import numpy as np
import matplotlib.pyplot as plt
from numexpr import evaluate
from math import pi
def testset():
count = 450
rcoords = np.random.rand(count, 3)
rcoords[:,2] = rcoords[:,2] * 0.005 + 0.005
package main
import (
"bufio"
"bytes"
"fmt"
"os"
)
type State int
@apage43
apage43 / patentparse.clj
Last active December 23, 2015 23:29
parse USPTO patent assignment XML files (lazily, out of the zips from http://www.google.com/googlebooks/uspto-patents-assignments.html )
(ns patentparse
(:import [java.util.zip ZipEntry ZipInputStream])
(:require [clojure.java.io :as io]
[clojure.string :as st]
[clojure.data.xml :as dxml]))
(def dateformat (java.text.SimpleDateFormat. "yyyyMMdd"))
(defn tag-p? [tag]
(fn [i] (= tag (:tag i))))
[Unit]
Description=Buildy Service
After=network.target
[Service]
User=apage43
ExecStart=/home/apage43/runbuildy.sh
Restart=always
RestartSec=10