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
jq -c '.[] | select(.name == "Сокольническая").stations | .[] | [1, 1, .order+1, .name, .status, .lat, .lng]' ~/Downloads/metro.msk.json > 1 |
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
WITH | |
-- схлопываем интервалы в максимально длинные непрерывные | |
-- так чтобы из такого: | |
-- | |
-- id | aircraft_id | from_date | to_date | | |
-- -----+-------------+------------+------------+ | |
-- 793 | 145 | 2017-06-01 | 2017-09-30 | | |
-- 841 | 145 | 2017-09-30 | 2017-12-31 | | |
-- 842 | 145 | 2017-10-03 | 2017-12-31 | | |
-- 794 | 145 | 2018-01-01 | ¤ | |
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
REPL = "Read - Eval - Print" Loop |
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
# encoding: utf-8 | |
# (c) 2016 Alexander Saltanov <[email protected]> | |
""" | |
Aircraft tail number parsing and formatting library for Python | |
Examples of use: | |
>>> | |
>>> n = parse('v-q b-l-n') |
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
# Replace ``netstat -rn | grep "^0.0.0.0 " | cut -d " " -f10`` with direct parsing of /proc/net/route | |
def get_default_gateway_linux(): | |
"""Read the default gateway directly from /proc.""" | |
import socket, struct | |
with open("/proc/net/route") as f: | |
for line in f: | |
fields = line.strip().split() | |
if fields[1] != '00000000' or not int(fields[3], 16) & 2: | |
continue | |
return socket.inet_ntoa(struct.pack("=L", int(fields[2], 16))) |
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/bash | |
for a in *.flac; do | |
# give output correct extension | |
OUTF="${a[@]/%flac/mp3}" | |
# get the tags | |
ARTIST=$(metaflac "$a" --show-tag=ARTIST | sed s/.*=//g) | |
TITLE=$(metaflac "$a" --show-tag=TITLE | sed s/.*=//g) | |
ALBUM=$(metaflac "$a" --show-tag=ALBUM | sed s/.*=//g) |
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/bash | |
find . -type f -name '*.m[p4][a3]' -exec bash -c 'fn=$(basename "$0"); ext=$(echo "${fn##*.}" | tr '[A-Z]' '[a-z]'); mv "$0" "$(sha1sum "$0" | cut -d" " -f1).$ext"' {} \; |
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
Там где море волнуется | |
Там где синеет неба сталь | |
Летит и немного хмурится | |
Дитмар Эльяшевич Розенталь |
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
find . -type f -exec sha1sum "{}" >> SHA1SUMS.txt \; ; grep -v .DS_Store SHA1SUMS.txt | grep -v SHA1SUMS > SHA1SUMS ; rm SHA1SUMS.txt ; sha1sum -c SHA1SUMS |
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
server { | |
listen 80; | |
server_name www.{{name}}; | |
access_log off; | |
rewrite ^(.*)$ http://{{name}}$1; | |
} | |
server { | |
listen 80; | |
server_name {{name}}; |