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 bash | |
read -p "This will create Audacity launcher for an appImage found nearby. Press Enter to begin." | |
echo Creating audacity/ directory ... | |
mkdir -p audacity/ | |
echo Searching for Audacity appImage nearby ... | |
find ./ -maxdepth 1 -type f -name "audacity*.AppImage" -print0 | xargs -0 -I{} mv "{}" "audacity/audacity.AppImage" |
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 os import getuid | |
from time import sleep | |
_uid = getuid() | |
p_out = open(f'/tmp/audacity_script_pipe.to.{_uid}', 'w') | |
p_in = open(f'/tmp/audacity_script_pipe.from.{_uid}', 'r') | |
def write(cmd: str): |
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
# Python-скрипт преобразует прошивки с https://chiptuner.ru/content/ser_m86/ | |
# из двоичного представления (bin) в шестнадцатеричное (hex), которое используются | |
# в Infineon Memtool. | |
# | |
# Требуется установленный пакет intelhex: | |
# pip install intelhex | |
# | |
# Запуск: | |
# python m86bin2hex.py < I765BL57v3.bin > I765BL57v3.hex | |
# |
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 | |
from dateutil import relativedelta | |
def get_months(since): | |
delta = relativedelta.relativedelta(datetime.now(), since) | |
months = delta.months + (delta.years * 12) | |
return months | |
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 | |
measure () { | |
local RES=$(python3.7 -m timeit -n 2000000 -s 'x=256' "$1" | cut -d ":" -f 2) | |
echo "$1 -> $RES" | |
} | |
measure 'str(x)' | |
measure 'f"{x}"' |
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 | |
import requests | |
import html | |
API_KEY = '' | |
'''Google API (YouTube Data API v3) key from https://console.developers.google.com/apis/.''' | |
# Put titles you're interested into RELEVANT string: | |
# one title per line. These are regular expressions. | |
# NOTE: escape (), [], etc. |
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 -*- | |
""" | |
https://gist.github.com/idlesign/6000f730a7fa2421b34a5287d6011a8b | |
Based on | |
https://gist.github.com/jean-helsinki/85b3ea97b7445abdd9a7 | |
""" | |
from __future__ import unicode_literals |
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 will produce an SQL to query Google BigQuery | |
for a certain author packages downloads monthly statistics. | |
""" | |
try: | |
import xmlrpclib | |
except ImportError: | |
import xmlrpc.client as xmlrpclib |
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
# -Fc - `format - custom` for parallel restore; not sql commands; compression | |
> pg_dump -Fc db_name > name.dump | |
# most of time - index recreation | |
> pg_restore --dbname=db_name name.dump | |
# can be parallel; jobs=num of cores +1 | |
> pg_restore --jobs=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
sudo dd if=/dev/zero of=/swapfile bs=1024 count=524288 | |
sudo chmod 600 /swapfile | |
sudo mkswap /swapfile | |
sudo swapon /swapfile | |
sudo swapoff /swapfile |
NewerOlder