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 socket | |
class Netcat: | |
""" Python 'netcat like' module """ | |
def __init__(self, ip, port): | |
self.buff = "" | |
self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) |
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
# wipe the disk | |
wipefs –a /dev/sda | |
parted /dev/sda mklabel gpt | |
parted /dev/sda mkpart logical ext4 0% 100% | |
mkdir /mnt/usb | |
cryptsetup luksFormat /dev/sda1 # type YES and then enter a password | |
dd if=/dev/urandom of=/root/keyfile bs=1024 count=4 | |
chmod 0400 /root/keyfile | |
cryptsetup luksAddKey /dev/sda1 /root/keyfile #Enter passphrase | |
cryptsetup open /dev/sda1 encrypted |
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 | |
# this tends to occur when I unplug a usb mouse | |
# cursor locks up, can click, can't move it - Xubuntu 18.10 | |
# the following commands just reload the mouse module in the kernel | |
# fixes issue for the instance, yay | |
sudo modprobe -r psmouse | |
sudo modprobe psmouse |
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
# not made by me, but useful | |
$dpid = Get-ItemProperty -Path "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name "DigitalProductId" | |
# Get the range we are interested in | |
$id = $dpid.DigitalProductId[52..(52+14)] | |
# Character table | |
$chars = "BCDFGHJKMPQRTVWXY2346789" | |
# Variable for the final product key |
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
0.0.0.0 www.example.com | |
0.0.0.0 example.com | |
::0 www.example.com | |
::0 example.com |
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 apt-get install calibre | |
ebook-convert book.epub book.mobi |
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
# truncate num_bytes off the end of a file | |
import os | |
def trunc(filename, num_bytes): | |
with open(filename, 'rb+') as fi: | |
fi.seek(-1 * num_bytes, os.SEEK_END) | |
fi.truncate() |
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 | |
# | |
# Σ i | |
# i=s | |
from functools import reduce | |
# the sequence to sum, you can use range(blah) as well | |
s = [1, 2, 3, 5] |
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 is a work in progress notepad, will include pdftk and ghostscript stuff | |
# replace page 13 of doc1.pdf with doc2.pdf | |
pdftk A=doc1.pdf B=doc2.pdf cat A1-12 B1 A14-end output out1.pdf | |
# remove the first 4 pages from in.pdf | |
pdftk A=in.pdf cat A5-end output out.pdf | |
# use ghostscript to combine PDFs | |
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -dAutoRotatePages=/None -sOutputFile=finished.pdf file1.pdf file2.pdf file3.pdf |
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 fill a disk to 5TB with one command, accounting for existing disk usage | |
# $a will be in kilobytes, so it must be converted in the expr to units of 150MB | |
# bs is set for efficiency, results on your disk may vary, if you change this, you'll need to change the number at the end in expr (currently 1024 * 150) | |
# the sed command specifies line 9 of the output pulled from df -k, you will need to change for your df output | |
dd if=/dev/zero of=/mnt/partition/bigfile bs=150MB count=$(let "a = 5368709120-`df -k | awk '{ print $3 "\t" }' | sed -n '9p'`"; expr $a / 153600) |
OlderNewer