Sometimes, you need to quickly dump a json file into sqlite, just to run some queries on it. This is a two-step process:
cat file.json | jq -r '.data | map([.field1, .field2, .field3] | @csv)| join("\n")' > file.csv
[System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("SecretMessage")) | |
[System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String("U2VjcmV0TWVzc2FnZQ==")) |
#!/usr/bin/env python3 | |
# | |
# Ad-hoc monitoring for time_squeeze changes in /proc/net/softnet_stat . | |
# | |
# usage: ./softnetstat.py <refresh_interval_seconds> | |
# | |
# see https://blog.packagecloud.io/eng/2016/06/22/monitoring-tuning-linux-networking-stack-receiving-data/ | |
# | |
from time import sleep | |
from datetime import datetime |
export token="yourtokenfrombotfather"
. If you need to re-issue a token, use /revoke command to botfather.#!/bin/bash
set -eu -o pipefail
$ cat > TTS.json <<END
{
"audioConfig": {
"audioEncoding": "LINEAR16",
"pitch": 0,
"speakingRate": 1
},
#!/usr/bin/env python3 | |
import socket | |
import time | |
userid = "trivial_sip_pinger" | |
domain = "<sip server to test>" | |
port = 5060 | |
timeout_ms = 1000 | |
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) |
First, find out which is the encrypted LVM partition
cat /etc/crypttab
To add a new password, use luksAddKey:
sudo cryptsetup luksAddKey /dev/sda3
To remove an existing password, use luksRemoveKey:
#!/bin/bash | |
TARGET_FILE_NUM=$1 | |
CURRENT_FILE_NUM=`ls -l | wc -l` | |
FILES_TO_GENERATE=$((TARGET_FILE_NUM - CURRENT_FILE_NUM)) | |
if [[ $FILES_TO_GENERATE -lt 0 ]]; then | |
echo "We already have $CURRENT_FILE_NUM files, no need to generate more" | |
exit | |
fi |
#!/bin/bash | |
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -sha256 -days 365 -nodes |
https://stackoverflow.com/questions/614795/simulate-delayed-and-dropped-packets-on-linux | |
https://wiki.linuxfoundation.org/networking/netem | |
```bash | |
TARGET1='8.8.8.8' | |
DEV='eth0' | |
tc qdisc delete dev $DEV root | |
tc qdisc add dev $DEV root handle 1: prio |