Skip to content

Instantly share code, notes, and snippets.

View sokil's full-sized avatar
🇺🇦
sapere aude

sokil

🇺🇦
sapere aude
View GitHub Profile
@sokil
sokil / pem.sh
Last active June 28, 2021 08:54
PEM generation
# create private key with passphrase
openssl genrsa -out config/jwt/private.pem -aes256 4096
# Write public key
openssl rsa -pubout -in private.pem -out public.pem
@sokil
sokil / StaticSiteGenerators.md
Last active May 6, 2021 20:33
Static Site Generators
@sokil
sokil / CryptPartition.sh
Last active February 8, 2021 20:15
Crypt Partition
# format in luks
sudo cryptsetup luksFormat --hash=sha512 --key-size=512 /dev/sda7
# create mapping
sudo cryptsetup open --type=luks /dev/sda7 SECURED
# check mapping
sudo cryptsetup -v status SECURED
# format partition
@sokil
sokil / Musql_Slow_query_log.sh
Last active January 14, 2021 10:50
Musql Slow Query Log
SET GLOBAL slow_query_log = 'ON';
select @@long_query_time;
SET GLOBAL long_query_time = 5;
select @@slow_query_log_file;
SET GLOBAL slow_query_log_file = '/path/filename';
SET GLOBAL slow_query_log = 'OFF';
git clone https://github.com/RinCat/RTL88x2BU-Linux-Driver
make
sudo make install
sudo modprobe 88x2bu
####
git clone https://github.com/morrownr/88x2bu
sudo ./install-driver.sh
@sokil
sokil / dateModify.php
Created November 4, 2020 15:44
PHP date modifications
<?php
function test($timeOffsetMS)
{
$modification = sprintf('-%s msec', $timeOffsetMS);
echo 'Modificator: ' . $modification . PHP_EOL;
$time = 1604503053.0000; // microtime(true);
$timeString = sprintf('%0.6F', $time);
echo 'Source: ' . $timeString . PHP_EOL;
@sokil
sokil / bash_awk_split.md
Created September 11, 2020 13:53
ark split
2020-01-01 12:13:14 8
2020-01-01 12:13:14 7
2020-01-01 12:13:14 8
2020-01-01 12:13:14 9
cat file | awk -F' ' '{split($1, date, "-"); print date[1] "-" date[2] "\t" $3}'
@sokil
sokil / mysqldump.aws.sh
Last active July 30, 2023 19:00
Backup mysql dtabase to Aamzon Web Services
#/bin/env bash
# First configure aws cli to authenticate on aws.
# See https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-quickstart.html#cli-configure-quickstart-creds
CURRENT_DIR=$(dirname $(readlink -f $0))
CURRENT_DATE=$(date +%Y%m%d%H%M)
source .env # path to MySQL credentials
mysqldump -h$MYSQL_HOST -u$MYSQL_USER -p$MYSQL_PASSWORD $MYSQL_DB > /tmp/$CURRENT_DATE.sql
@sokil
sokil / delete_insert_deadlock.sql
Last active November 28, 2023 13:11
select for update deadlock
## Connection 1
1. begin
3. delete from table where id = 1;
5. insert into table values (1);
## Connection 2
2. begin
@sokil
sokil / LetsEncrypt.sh
Last active May 3, 2020 12:59
LetsEncrypt
# generate cert from another host with validation by dns TXT record
certbot certonly --manual --preferred-challenges dns