Skip to content

Instantly share code, notes, and snippets.

View markuskreitzer's full-sized avatar

Markus markuskreitzer

View GitHub Profile
@markuskreitzer
markuskreitzer / catalog_files.py
Created March 30, 2021 22:45
Multithreaded File Scanner and Checksum Generator
import hashlib
import multiprocessing
import os
import queue
import threading
import time
from queue import Queue
from typing import Any, TextIO, Dict
import yaml
@markuskreitzer
markuskreitzer / .bashrc.md
Last active December 5, 2019 19:55
IP Info Function for BashRC

IP Info Function for bash shell loading.

The following function is used to determine a few basics about the network of the user, such as, external and internal IP addresses, subnet, the default gateway, and who's logged in. Note that the 3-liner, ext_ip_info.py is also attached to this gist.

function host_information(){
        export GATEWAY=$(netstat -nr | perl -lne 'print $1 if m/default\s+(.+?)\s+?.+?en0/g')
        export MY_EXT_IP=$(curl -s https://icanhazip.com)
        export EXT_IP_OWNER=$(python3 bin/ext_ip_info.py $MY_EXT_IP)
        export MY_INT_IP=$(nmap --iflist |perl -lne 'print "$1" if m/en0\s+\S+\s+(\S+)\/(\S+)\s+ethernet/g'|head -n1)
@markuskreitzer
markuskreitzer / README.md
Created July 30, 2018 16:15
How to connect a Raspberry Pi to a WPA2 Enterprise Network

How to connect a Raspberry Pi to a WPA2 Enterprise Network

tags: Auburn, Auburn University, WPA2, WPA2 Enterprise

Auburn University is gracious enough to provide instructions to Ubuntu users on how to connect their hosts to the Auburn University WiFi Network.

Many Universities use WPA2 Enterprise authentication on their networks. This allow you to track WHO is connected where and have granular control over who's able to access the WiFi network.

For tinkerers and experimenters with Raspberry Pi, Particle Photon, and other embedded systems, this poses a problem because many simplier IoT devices do not support WPA2 Enterprise natively or not without some hassle.

Raspbian Jesse and earlier will display a WPA2 Enterprise network from its dropdown list, but it will be greyed out. The workaround is to manually connect to it:

Download All Typora Themes

Run the following commands after downloading the findlinks utility to a directory in your $PATH variable.

$ mkdir Typora_Themes
$ cd Typora_Themes/
$ for i in $(printlinks https://theme.typora.io/ theme);do echo Downloading $i;wget --content-disposition $(printlinks https://theme.typora.io$i Download);echo;echo;done
@markuskreitzer
markuskreitzer / .bashrc.sh
Created July 25, 2018 23:12
Hack brew to always keep a copy of your latests casks and brews on Dropbox
# Append the following to your .bashrc or file that contains your user profile:
function brew(){
case $1 in
install)
echo "Install"
/usr/local/bin/brew $*
/usr/local/bin/brew list > ~/Dropbox/new_comp/mac/brews_autolisted.txt
;;
cask)
echo "Cask"
### Keybase proof
I hereby claim:
* I am elec3647 on github.
* I am lyapunov (https://keybase.io/lyapunov) on keybase.
* I have a public key ASAVeQnnf40XlbNkE_rjZvW99A5Q9WOz1hn4o1WCE5S5nwo
To claim this, I am signing this object:
@markuskreitzer
markuskreitzer / distance_matrix.py
Created September 5, 2017 19:52
Prints distance between all points in a 2x2 matrix
#!/usr/bin/env python
import numpy as np
a = np.ones([2,2])
for from_rownum, row in enumerate(a):
for from_colnum, number in enumerate(row):
print "Cell:", from_rownum, from_colnum
for to_rownum, row in enumerate(a):
for to_colnum, number in enumerate(row):
distance = np.sqrt((to_rownum - from_rownum)**2 + (to_colnum - from_colnum)**2)
# coding=utf-8
import urllib2
from bs4 import BeautifulSoup
fortune_500 = 'http://fortune.com/fortune500/2015'
page = urllib2.urlopen(fortune_500)
#page = open('boo.html')
soup = BeautifulSoup(page, 'lxml')
@markuskreitzer
markuskreitzer / README.md
Last active August 29, 2015 14:00
Decypt and Encrypt using OpenSSH pivate and public keys

How to encrypt a file using a OpenSSH public key.

Requirements:

  • openssl
  • ssh-keygen
  • sshpub-to-rsa
    • Python with the following libs:
      • pyasn1

Directions

If you haven't already, generate an SSH key using ssh-keygen. Not that you encrypt with the public key (that everyone has) and decrypt with the private key (the secret key only you have).

@markuskreitzer
markuskreitzer / C_and_F_primes.py
Created March 20, 2014 15:54
Check to see if corresponding C and F values are prime.
from pyprimes import isprime
'''
Quick little program I came up with. I was driving around Auburn when I
wondered what temperatures could be prime for both F and C.
(C) Markus Kreitzer, 2014
This work is licensed under the Creative Commons
Attribution-NonCommercial-ShareAlike 4.0 International License.