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 | |
if [[ "$#" != "1" ]]; then | |
echo "Provide the original image ISO" | |
exit 1 | |
fi | |
sudo snap install distrobuilder --classic | |
sudo apt install -y libguestfs-tools wimtools genisoimage |
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 | |
set +e | |
backup() { | |
if [[ -e "$1.backup" ]]; then | |
echo "Backup file already exists! Remove if necessary." | |
exit 10 | |
fi | |
echo "Creating backup of $1 in $1.backup" >&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
# create damn simple TFTP dasemon | |
IFACE='ens0p25' | |
sudo dnsmasq -i $IFACE --dhcp-range=192.168.69.100,192.168.69.150 --enable-tftp --tftp-root=/home/$USER/tftdir -d -u $USER -p0 -K --log-dhcp --bootp-dynamic |
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 argparse | |
def f(x): | |
print(x) | |
class Fusion: | |
""" |
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 python3 | |
""" | |
Generates land register codes in Poland for given court symbol | |
""" | |
from itertools import starmap | |
import operatortype command to continue | |
import argparse |
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 -e -p 'Give cluster IP:' -i "$( hostname )" IP | |
read -e -p 'Give cluster node:' -i "$( hostname )" NODE | |
read -e -p 'any node suffix?:' -i '_es-01' SUFFIX | |
IFS=$'\n' | |
for line in $(curl -s "$IP:9200/_cat/shards" | fgrep UNASSIGNED); do | |
INDEX=$(echo $line | (awk '{print $1}')) | |
SHARD=$(echo $line | (awk '{print $2}')) | |
echo "Reassigning $SHARD $INDEX" |
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 python3 | |
# very crude but works ;-) | |
import bs4 | |
import base64 | |
bs4.BeautifulSoup(open('sms.xml'), 'lxml-xml') | |
parts=bs.findAll('part') | |
for part in parts: | |
if part.parent.parent.findAll('addr', attrs={'address':'+48XXXXXXXXXX'}): | |
if part.attrs['ct'] not in ('text/plain', 'application/smil'): |
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 sys | |
def huawei_sms2txt(bytes): | |
""" | |
Calculates text response from Huawei E3372 modem SMS in text mode (AT+CMGF=1) | |
to readable one | |
""" | |
return ''.join([ | |
y for e,y in enumerate(chr(int(x,16)) | |
for x in re.findall(r'\w{2}', bytes)) if e % 2 != 0]) |
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
# thanks http://www.jdgleaver.co.uk/blog/2014/05/23/samsung_ssds_reading_total_bytes_written_under_linux.html | |
echo "GB Written: $(echo "scale=3; $(sudo /usr/sbin/smartctl -A /dev/sda | grep "Total_LBAs_Written" | awk '{print $10}') * 512 / 1073741824" | bc | sed ':a;s/\B[0-9]\{3\}\>/,&/;ta')" |
NewerOlder