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 setproctitle | |
setproctitle.setproctitle("qutebrowser") | |
# Bindings | |
config.bind("gi", "hint inputs") | |
config.bind("<f12>", "inspector") | |
config.unbind("+") | |
config.unbind("-") | |
config.unbind("=") |
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
#!/usr/bin/env python3 | |
import sys | |
import numpy as np | |
KEYPADS = [ | |
np.array([ | |
["1", "2", "3"], | |
["4", "5", "6"], | |
["7", "8", "9"], |
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
#!/usr/bin/env python3 | |
import sys | |
steps = next(sys.stdin).split(", ") | |
x = 0 | |
y = 0 | |
for step in steps: |
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
#!/usr/bin/env python3 | |
import sys | |
import numpy as np | |
data = np.loadtxt(sys.stdin).T.reshape(-1, 3).T | |
data.sort(axis=0) | |
print(np.sum(sum(data[:2]) > data[2])) |
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 | |
set -e | |
TRACK_ID="$1" | |
CLIENT_ID="..." | |
CLIENT_SECRET="..." | |
REFRESH_TOKEN="..." | |
ACCESS_TOKEN=$( |
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
set numerichints | |
set typelinkhints | |
set noautofocus | |
set manualcompletion | |
let barposition = "bottom" | |
unmap x | |
map d closeTab | |
map u :restore<Space> | |
map <C-u> scrollPageUp | |
map <C-d> scrollPageDown |
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 os | |
device_path = '/dev/hidraw7' | |
fd = os.open(device_path, os.O_RDWR) | |
report = bytearray(78) | |
report[0] = 0x11 | |
report[1] = 128 |
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 <stdio.h> | |
#include <string.h> | |
#include <unistd.h> | |
#include <fcntl.h> | |
#include <errno.h> | |
int main(int argc, char **argv) { | |
if (argc != 2) { | |
printf("Usage: %s hidraw_device\n", argv[0]); | |
return 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
pkt = bytearray(b'\x11\x80\x00\xff\x00\x00\x00\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') | |
device = open('/dev/hidraw7', 'wb') | |
device.write(pkt) | |
device.close() |
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
#!/usr/bin/env python3 | |
import itertools | |
import sys | |
lines = (x.split(" ")[::2] for x in sys.stdin.readlines()) | |
routes = {frozenset(x[:2]): int(x[2]) for x in lines} | |
places = set.union(*(set(x) for x in routes.keys())) | |
path_len = lambda path: sum(routes[frozenset(x)] for x in zip(path, path[1:])) | |
lengths = [path_len(x) for x in itertools.permutations(places)] |
NewerOlder