- Appearance > Auto-hide the Dock: on
- Appearance > Icon size: 20
- Search > Files + Characters: off
- Sound > Over-Amplification on
- Power > Auto brightness: off
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
package main | |
import ( | |
"flag" | |
"fmt" | |
"io" | |
"log" | |
"os" | |
"strconv" |
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
import re | |
s = lambda txt: re.sub(r'(?<!^)(?=[A-Z])', '_', txt).lower() | |
# eg: s("FooBarBaz") returns "foo_bar_baz" |
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
import threading | |
import time | |
import random | |
def thread_function(name, n): | |
print(f"Thread {name} starting - duration: {n}") | |
time.sleep(n) | |
if __name__ == "__main__": |
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
from datetime import datetime, timedelta | |
tic = datetime.now() | |
# do domething | |
d = (datetime.now() - tic) / timedelta(hours=1) | |
fmt_dur = lambda d: "{}".format(d)[:-7] |
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
def progress(it,every,total): | |
r = (it+1) % delta == 0 | |
p = ((it+1) / total) * 100 | |
if r: print(f"{p:.0f}%"); | |
for i in range(1_000_000): | |
progress( | |
it=i, | |
every=len(data)/10, | |
total=len(data)) |
distro name
lsb_release -a
or cat /etc/lsb-release
simple time
/usr/bin/time -f 'TIME:%e RAM:%M\n' go run cmd/dmc/*.go
quick bench cmd alias
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
import { useState, useEffect, useRef, useMemo } from 'react'; | |
export const useQuery = () => { | |
const abortCtrl = useMemo(() => new AbortController(), []) | |
// a priori | |
, url = useRef("") | |
, opt = useRef({}) | |
const [res, setRes] = useState(null) | |
, [err, setErr] = useState(null) |
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
# interfaces(5) file used by ifup(8) and ifdown(8) | |
# Include files from /etc/network/interfaces.d: | |
source-directory /etc/network/interfaces.d | |
# replace enp1s0 with your link according to: `$ip -c link show` | |
auto enp1s0 | |
iface enp1s0 inet static | |
address 192.168.1.8 | |
netmask 255.255.255.0 |
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
def cross(h, xs): | |
return [[h]+x for x in xs] | |
def combs(xs, n): | |
if n == 1: | |
return [[x] for x in xs] | |
res = [] | |
head = xs[:-n + 1] |
NewerOlder