Skip to content

Instantly share code, notes, and snippets.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#include <cctype>
#include <cstdio>
#include <string>
#include <algorithm>
std::string clean_string1(std::string w) {
w.erase(std::remove_if(w.begin(), w.end(), [](char &c) { return !isalpha(c); }), w.end());
std::transform(w.begin(), w.end(), w.begin(), tolower);
return w;
#!/usr/bin/env python3
import sys
import bisect
specials = []
with open("specials.txt", "r") as f:
for line in f:
specials.append(int(line.strip()))
specials.sort()
I0823 20:36:36.834892 1778 docker.go:327] Start docker client with request timeout=2m0s
I0823 20:36:36.867905 1778 aws.go:604] Zone not specified in configuration file; querying AWS metadata service
I0823 20:36:37.112241 1778 aws.go:726] AWS cloud filtering on tags: map[KubernetesCluster:pndtest]
I0823 20:36:37.112289 1778 server.go:349] Successfully initialized cloud provider: "aws" from the config file: ""
I0823 20:36:37.113350 1778 manager.go:138] cAdvisor running in container: "/"
W0823 20:36:37.222328 1778 manager.go:146] unable to connect to Rkt api service: rkt: cannot tcp Dial rkt api service: dial tcp 127.0.0.1:15441: getsockopt: connection refused
I0823 20:36:37.328437 1778 fs.go:139] Filesystem partitions: map[/dev/xvda1:{mountpoint:/var/lib/docker/aufs major:202 minor:1 fsType:ext4 blockSize:0}]
I0823 20:36:37.333430 1778 manager.go:192] Machine: {NumCores:2 CpuFrequency:2394478 MemoryCapacity:4143976448 MachineID:9da75450b5baeda6ab8af33757aa419a SystemUUID:EC26648B-0807-6D
#!/usr/bin/env python
import contextlib
import io
import os
import sys
inside_tmux = "TMUX" in os.environ
def symmetric_multi_difference(list_a, list_b):
seen = []
result = []
for element in list_a + list_b:
if element in seen:
continue
seen.append(element)
elements_in_a = [x for x in list_a if x == element]
$ cat somefile.yaml
options:
preferences:
delay: 1
use_mouse: 1
async: 0
$ cat temp.py
import pprint
import yaml
cesarkawakami@pandambp13r:~/temp/TheBigDeal [crap3]
$ cat factor.py
import collections
import math
def factor(n):
factors = collections.defaultdict(int)
for candidate in range(2, int(math.sqrt(n))):
if n == 1:
import math
m = [
[1, 2, 4, 7, 11, 16],
[3, 5, 8, 12, 17],
[6, 9, 13, 18],
[10, 14, 19],
[15, 20],
[21],