clean up bin a bit

This commit is contained in:
xfnw 2021-10-16 23:18:48 -04:00
parent a6bfd67e00
commit 4603c8d047
11 changed files with 139 additions and 136 deletions

122
bin/c Executable file
View file

@ -0,0 +1,122 @@
#!/bin/sh
# https://causal.agency/bin/c.html
set -eu
temp=$(mktemp -d)
trap 'rm -r "${temp}"' EXIT
exec 3>>"${temp}/run.c"
cat >&3 <<EOF
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <inttypes.h>
#include <limits.h>
#include <locale.h>
#include <math.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <wchar.h>
#include <wctype.h>
#include <dirent.h>
#include <fcntl.h>
#include <strings.h>
#include <unistd.h>
EOF
expr=
type=
while getopts 'e:i:t' opt; do
case "${opt}" in
(e) expr=$OPTARG;;
(i) echo "#include <${OPTARG}>" >&3;;
(t) type=1;;
(?) exit 1;;
esac
done
shift $((OPTIND - 1))
cat >&3 <<EOF
int main(int argc, char *argv[]) {
(void)argc;
(void)argv;
$*;
EOF
if [ -n "${type}" ]; then
cat >&3 <<EOF
printf(
_Generic(
${expr},
char: "(char) ",
char *: "(char *) ",
const char *: "(const char *) ",
wchar_t *: "(wchar_t *) ",
const wchar_t *: "(const wchar_t *) ",
signed char: "(signed char) ",
short: "(short) ",
int: "(int) ",
long: "(long) ",
long long: "(long long) ",
unsigned char: "(unsigned char) ",
unsigned short: "(unsigned short) ",
unsigned int: "(unsigned int) ",
unsigned long: "(unsigned long) ",
unsigned long long: "(unsigned long long) ",
float: "(float) ",
double: "(double) ",
long double: "(long double) ",
default: "(void *) "
)
);
EOF
fi
if [ -n "${expr}" ]; then
cat >&3 <<EOF
printf(
_Generic(
${expr},
char: "%c\n",
char *: "%s\n",
const char *: "%s\n",
wchar_t *: "%ls\n",
const wchar_t *: "%ls\n",
signed char: "%hhd\n",
short: "%hd\n",
int: "%d\n",
long: "%ld\n",
long long: "%lld\n",
unsigned char: "%hhu\n",
unsigned short: "%hu\n",
unsigned int: "%u\n",
unsigned long: "%lu\n",
unsigned long long: "%llu\n",
float: "%g\n",
double: "%g\n",
long double: "%Lg\n",
default: "%p\n"
),
${expr}
);
EOF
fi
if [ $# -eq 0 -a -z "${expr}" ]; then
cat >&3
fi
echo '}' >&3
cat >"${temp}/Makefile" <<EOF
CFLAGS += -Wall -Wextra -Wpedantic
EOF
make -s -C "${temp}" run
"${temp}/run"

View file

@ -1,36 +0,0 @@
#!/usr/bin/env python3
print('lickthecheese\'s assorted code.org modulus cracking tools')
def crack():
print('note: if no valid keypair exists, it will continue searching forever.')
print('press CTRL+c to cancel')
m = int(input('pub modulus> '))
p = int(input('pub key> '))
n = int(input('pub number> '))
i = 1
while p*i % m != 1:
i=i+1
print('done!')
print('alice\'s secret key is ', i)
print('bob\'s secret number is', ((i*n)%m))
def genbob():
m = int(input('pub modulus> '))
p = int(input('pub key> '))
n = int(input('secret number> '))
print('bob\'s public number is', ((p*n)%n))
if __name__ == '__main__':
print('0 crack secret key and number')
print('1 generate public number')
choice = int(input('choose tool> '))
func = [crack, genbob][choice]
func()

View file

@ -1,8 +0,0 @@
#!/bin/bash
awk '{print $2}' $1 |
awk -F ":" '{print $1}' |
cat - ~/Documents/nums |
sort | uniq -c | sort -k2 |
awk '{print $1-1}'

View file

@ -1,8 +0,0 @@
#!/bin/bash
chainfo $1 > /tmp/chacha
MACS=$(sort -h /tmp/chacha | tail -n 1)
awk '{print $1/'$MACS'*100}' /tmp/chacha

View file

@ -1,47 +0,0 @@
#!/usr/bin/env python3
import math, sys
si = input('size append d r c a> ')
print()
st = si[-1:]
try:
si = float(si[:-1])
except:
print('invalid input, please use the format <value><type letter>')
sys.exit()
def fromD(di):
r = di/2
fromR(r)
def fromC(ce):
r = ce / 6.28
fromR(r)
def fromA(ar):
r = math.sqrt(ar/3.14)
fromR(r)
def fromR(ra):
print("radius",ra)
print("diam", ra*2)
print("cerc", 3.14 * (ra*2))
print("area", 3.14*(ra*ra))
funcs = {
'd':fromD,
'r':fromR,
'c':fromC,
'a':fromA
}
if st in funcs:
funcs[st](si)
else:
print("invalid value type, the options are:")
for i in funcs:
print(i)

13
bin/ranal Executable file
View file

@ -0,0 +1,13 @@
#!/usr/bin/env python3
import random
sortedletters = {' ': [' '], 'A': ['A', 'a', 'ᴀ', '', ''], 'B': ['B', 'b', 'ß', 'ʙ', 'ẞ', '', ''], 'C': ['C', 'c', 'ʗ', '', '', ''], 'D': ['D', 'd', 'Ɖ', 'ᴅ', '', ''], 'E': ['⊘', 'E', 'e', 'ᴇ', '', 'ꭡ', '', ''], 'F': ['F', 'f', '', '', ''], 'G': ['G', 'g', 'ɡ', 'ɢ', '', ''], 'H': ['H', 'h', 'ʜ', '', ''], 'I': ['⫮', 'I', 'i', 'ı', 'ɪ', '', ''], 'J': ['J', 'j', 'ȷ', 'ᴊ', '', ''], 'K': ['K', 'k', 'ᴋ', '', ''], 'L': ['L', 'l', 'ʟ', '', ''], 'M': ['M', 'm', 'ᴍ', '', ''], 'N': ['Nj', 'N', 'n', 'ɴ', '', ''], 'O': ['O', 'o', '', '', ''], 'P': ['P', 'p', 'ᴘ', '', ''], 'Q': ['Q', 'q', '', ''], 'R': ['R', 'r', 'ʀ', '', '', '', 'ſ'], 'S': ['S', 's', '', ''], 'T': ['T', 't', 'ᴛ', '', ''], 'U': ['U', 'u', '', '', ''], 'V': ['V', 'v', '', '', ''], 'W': ['W', 'w', '', '', ''], 'X': ['X', 'x', '', ''], 'Y': ['Y', 'y', 'ʏ', '', ''], 'Z': ['Z', 'z', 'Dz', '', '', ''], '/': ['', '', '/', '', '⹊', '', '🙼'], '\\': ['\\', '', '', '', '🙽'], '!': ['', '!'], '~': ['','~'], '#':['','#'], '.':['.'], ',':[',']}
while True:
inp = input().upper()
for l in inp:
print(random.choice(sortedletters[l] if l in sortedletters else l),end='',flush=True)
print()

View file

@ -1,3 +0,0 @@
#!/bin/bash
zbarcam --raw -Sdisable -Scode128.enable

View file

@ -1,3 +0,0 @@
#!/bin/bash
zbarcam --raw --nodisplay -Sdisable -Scode128.enable

4
bin/rusb Executable file
View file

@ -0,0 +1,4 @@
echo -n "0000:00:1a.0" | tee /sys/bus/pci/drivers/ehci-pci/unbind
echo -n "0000:00:1d.0" | tee /sys/bus/pci/drivers/ehci-pci/unbind
echo -n "0000:00:1a.0" | tee /sys/bus/pci/drivers/ehci-pci/bind
echo -n "0000:00:1d.0" | tee /sys/bus/pci/drivers/ehci-pci/bind

28
bin/smb
View file

@ -1,28 +0,0 @@
#!/bin/bash
export SMBPATH="smb.txt"
export SMBID=$RANDOM
echo "welcome to smb"
if [[ ! -f $SMBPATH ]];then
read -p "Initilize smb in $SMBPATH ? "
echo "--top--" >> $SMBPATH
fi
read -p "title your post: " TITLE
mkdir /tmp/smb/$USER/ -p
vim /tmp/smb/$USER/$SMBID
if [[ -f "/tmp/smb/$USER/$SMBID" ]];then
echo "================================================================================">> /tmp/smb/$USER/$SMBID.t
echo "Title: $TITLE" >> /tmp/smb/$USER/$SMBID.t
date "+Posted on: %Y-%m-%d\\" | tr '\\\\' "\n" >> /tmp/smb/$USER/$SMBID.t
cat /tmp/smb/$USER/$SMBID >> /tmp/smb/$USER/$SMBID.t
echo -e "================================================================================\n\n" >> /tmp/smb/$USER/$SMBID.t
sed -i "/--top--/r /tmp/smb/$USER/$SMBID.t" $SMBPATH
else
echo "aborting..."
fi

View file

@ -1,3 +0,0 @@
#!/bin/bash
zbarcam --raw -Sdisable -Scode128.enable | crikey -i