Skip to content

Instantly share code, notes, and snippets.

View jshwi's full-sized avatar

Stephen Whitlock jshwi

View GitHub Profile
@jshwi
jshwi / ipython_config.py
Created February 26, 2021 00:52
Ipython Profile (Monokai)
# Configuration file for ipython.
#------------------------------------------------------------------------------
# InteractiveShellApp(Configurable) configuration
#------------------------------------------------------------------------------
## A Mixin for applications that start InteractiveShell instances.
#
# Provides configurables for loading extensions and executing files as part of
# configuring a Shell environment.
@jshwi
jshwi / fullapt.py
Last active February 26, 2021 01:02
Full apt-get routine for Debian derivatives
#!/usr/bin/env python3
"""
fullapt
=======
Full apt-get routine for Debian derivatives
"""
# Copyright 2020 Stephen Whitlock
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
@jshwi
jshwi / rootfinder.py
Created October 30, 2020 10:26
Return the root of your repository
#!/usr/bin/env python3
"""rootfinder
=============
Return the root of your repository
"""
# Copyright 2020 Stephen Whitlock
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@jshwi
jshwi / pybar.py
Created October 30, 2020 10:22
Progress bar for python scripts
#!/usr/bin/env python3
"""
pybar
=====
"""
# Copyright 2020 Stephen Whitlock
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
@jshwi
jshwi / pysort.py
Created October 30, 2020 10:17
Sort files the way python's sorted() function sorts
#!/usr/bin/env python3
"""pysort
=========
Sort files in pythonic order
"""
# Copyright 2020 Stephen Whitlock
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@jshwi
jshwi / DD-WRT firewall Rule
Last active October 30, 2020 10:27
For transparent proxy server using DD-WRT router
# IPTables
# squid variables
PROXY_IP=192.168.1.1 # Squid_Proxy_Server_Host
PROXY_PORT=3128 # Proxy_Port
LAN_IP=`nvram get lan_ipaddr`
LAN_NET=$LAN_IP/`nvram get lan_netmask`
# squid transparent proxy
iptables -t nat -A PREROUTING -i br0 -s $LAN_NET -d $LAN_NET -p tcp --dport 80 -j ACCEPT
iptables -t nat -A PREROUTING -i br0 -s ! $PROXY_IP -p tcp --dport 80 -j DNAT --to $PROXY_IP:$PROXY_PORT