I hereby claim:
- I am spoterianski on github.
- I am m0n0 (https://keybase.io/m0n0) on keybase.
- I have a public key ASBFH15VLtcq0ra5YkTQkOXzoBCl2BDKXsm8cnG7YTzsEQo
To claim this, I am signing this object:
#!/bin/zsh | |
HOST="remote-hostname" | |
PORT="22" | |
TIMEOUT="10" | |
OBSIDIAN_VAULT="/home/user/Obsidian/Notes" | |
if ssh -o ConnectTimeout=$TIMEOUT -p $PORT "$HOST" echo "SSH is up"; then | |
echo "Host $HOST is available" | |
else |
#!/bin/bash | |
# Description: Split an m4b into its chapters. No recoding is done, just splitting | |
# Usage: m4b_split.sh $input_file $output_dir/ | |
# Requires: ffmpeg, jq | |
# Author: Hasan Arous, Sergey Poterianski | |
# License: MIT | |
in="$1" | |
out="$2" |
# Математика 4 класс | |
# Генератор примеров для вычитание четырехзначных чисел | |
import random | |
res = [] | |
for i in range(20): | |
a = random.randint(100, 9999) | |
b = random.randint(100, 9999) | |
if b > a: | |
a, b = b, a | |
print(f'{i})\n') |
''' | |
Example of Tornado that autoreloads/watches all files in folder 'static' | |
''' | |
import tornado.ioloop | |
import tornado.web | |
import tornado.autoreload | |
import os | |
''' serves index.html''' |
I hereby claim:
To claim this, I am signing this object:
-- show running queries (pre 9.2) | |
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(query_start, clock_timestamp()), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
#include <Arduino.h> | |
#include <U8g2lib.h> | |
#ifdef U8X8_HAVE_HW_SPI | |
#include <SPI.h> | |
#endif | |
#ifdef U8X8_HAVE_HW_I2C | |
#include <Wire.h> | |
#endif |
For symmetic encryption, you can use the following: | |
To encrypt: | |
openssl aes-256-cbc -salt -a -e -in plaintext.txt -out encrypted.txt | |
To decrypt: | |
openssl aes-256-cbc -salt -a -d -in encrypted.txt -out plaintext.txt | |
For Asymmetric encryption you must first generate your private key and extract the public key. |
#!/usr/bin/env python | |
# coding=utf-8 | |
import sys | |
def go(key_filename, filename): | |
k = open(key_filename) | |
keys = list() | |
while 1: | |
lines = k.readlines(100000) |
""" | |
Get yesterday | |
""" | |
def get_yesterday(self): | |
today = datetime.date.today() | |
d = datetime.timedelta(days=1) | |
yesterday = today - d | |
return yesterday.strftime('%Y%m%d') |