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
// Для использования в Android с программой Tasker. | |
// Формирует текущее время в текстовом виде для передачи любой русскоговорящей системе TTS. | |
// Решает проблему некорректного произношения времени, например 0:00, или 20:00. | |
// Проверен с русскими голосами Acapella и SVOX. | |
var hours = { | |
"час": [1, 21], | |
"часа": [2, 3, 4, 22, 23], | |
"часов": [0, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20] | |
} |
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
# -*- coding: UTF-8 -*- | |
""" | |
CLI скрипт, поддерживающий две ветви параметров: | |
userdb.py append <username> <age> | |
userdb.py show <userid> | |
Заглушка предусматривает, что: | |
пользователь с именем admin уже существует | |
по userid = 1 всегда возвращается User(name='admin', age=20) |
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
@echo off | |
if "%~1" == "" ( | |
echo Usage: %0 [file to decrypt] | |
) else ( | |
gpg --batch %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
def swap_nibbles(s): | |
"""Swap nibbles in a hex string. | |
len(s) must be even otherwise ValueError will be raised. | |
""" | |
if len(s) % 2: | |
raise ValueError() | |
return ''.join([y+x for x,y in zip(*[iter(s)] * 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
def bytes2int(b): | |
"""Convert list/tuple of two bytes to integer value""" | |
if len(b) != 2: raise ValueError('b must have exactly 2 items') | |
return (b[0] << 8) + b[1] | |
def int2bytes(i): | |
"""Convert integer value to list of bytes""" | |
if i > 0xFFFF: | |
raise ValueError() |
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
----- Esc ----- | |
Quick change directory: Esc + c | |
Quick change directory history: Esc + c and then Esc + h | |
Quick change directory previous entry: Esc + c and then Esc + p | |
Command line history: Esc + h | |
Command line previous command: Esc + p | |
View change: Esc + t (each time you do this shortcut a new directory view will appear) | |
Print current working directory in command line: Esc + a | |
Switch between background command line and MC: Ctrl + o | |
Search/Go to directory in active panel: Esc + s / Ctrl + s then start typing directory name |
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
"""Преобразование списка файлов из параметров командной строки в список имен | |
файлов (без расширений), разделенный запятыми. Результат копируется в буфер | |
обмена | |
Пример: | |
было ['aaa.zip.pgp', 'bbb.zip.pgp', 'ccc.zip.pgp'] | |
стало 'aaa, bbb, ccc' | |
""" | |
from sys import argv | |
from os import path | |
from Tkinter import Tk |
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 a [1 2 3 4 6 8 9 11 12 13 14 20 21 23 24 25]) | |
(loop [sq (rest a) fv (first a) lv (first a) res []] | |
(if (empty? sq) | |
(conj res [fv lv]) | |
(if (= (- (first sq) lv) 1) | |
(recur (rest sq) fv (first sq) res) | |
(recur (rest sq) (first sq) (first sq) (conj res [fv lv]))))) | |
=> [[1 4] [6 6] [8 9] [11 14] [20 21] [23 25]] |
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
(doseq [n (repeatedly 5 #(rand-int 128))] | |
(printf "%02X (%d)\n" n 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
on run | |
open {choose file with prompt "Choose a file to create a symbolic link:" without invisibles} | |
end run | |
on open the_files | |
repeat with i from 1 to (count the_files) | |
try | |
set posix_path to POSIX path of (item i of the_files) | |
if posix_path ends with "/" then set posix_path to text 1 thru -2 of posix_path | |
do shell script "ln -s " & quoted form of posix_path & " " & quoted form of (posix_path & ".sym") |
OlderNewer