Skip to content

Instantly share code, notes, and snippets.

View cyphunk's full-sized avatar

Nathan Fain cyphunk

  • stage theatre + reverse engineering
View GitHub Profile
@cyphunk
cyphunk / activeportal.py
Created December 5, 2022 12:57
activeportal notes pulled from surrogatewitch performance project. use in combined with wifi_hostpost.sh from pitheatre
#!/usr/bin/env python3
# opens a HTTP and HTTPS server
port = 8083
portssl = 8443
# NGINX Setup in sites-enabled:
"""
test -e /etc/nginx/sites-available/captiveportal_http \
|| cat <<EOF > /etc/nginx/sites-available/captiveportal_http
server {
@cyphunk
cyphunk / softmax.js
Last active April 6, 2024 11:21 — forked from vladimir-ivanov/softmax.js
softmax function implementation in js
// Fork & examples for the one-line version by @vladimir-ivanov:
//let softmax = (arr) => (index) => Math.exp(arr[index]) / arr.map(y => Math.exp(y)).reduce((a, b) => a + b);
//
// Also see comments for improvements
function softmax(arr) {
return arr.map(function(value,index) {
return Math.exp(value) / arr.map( function(y /*value*/){ return Math.exp(y) } ).reduce( function(a,b){ return a+b })
})
}
@cyphunk
cyphunk / chatgpt-testmaths.py
Last active May 26, 2023 09:34
chatgpt basic math test
# Ask chatgtp following prompted questions in order
# and then compare with the results with code herein
# 1. Create a list of 50 random float point numbers
# between 50 and 100 with a maximum of 1 decimal place.
# 2. Sort the list
# 3. Calculate the gap between each number
# 4. Sort the results by gap, with largest gap first
#
# for questions email nathan at squimp.com
#
@cyphunk
cyphunk / torforced.sh
Last active April 13, 2023 15:44
torforced runs command with network access restricted to torport (or specified network port)
# provide torport and then command + args
echo $1 | grep -E -q '^[0-9]+$' || echo "args: torport command (e.g. 9050 or 9150). Note, this command does not automatically forward traffic of command through tor, it only restricts network acces of command to torport. You must configure the target application to use tor/socks/whatever independently. Test with command 'printf \"GET / HTTP/1.1\r\nHost: check.torproject.org\r\n\r\n\" | torforced 9050 torsocks nc check.torproject.org 80' or 'torforced 9050 torsocks curl http://checkip.dyndns.org'"
echo $1 | grep -E -q '^[0-9]+$' || exit 1
# This may not provide the same level of assuranced that tor browser does
# It just makes certain you do not do something stupid on your own
# or something unknown happening in the background.
port=$1
shift
# will setup a group,
# restrict with iptables the permitted ports for that group
@cyphunk
cyphunk / covid2023stats.py
Last active February 28, 2023 11:54
covid stats 2023
def calculate(country,pop,c,d):
print(f"{country}: pop {pop}mil, cases {c}mil, deaths {d}")
print(f"death per popul %{((d/(pop*1000000))*100):.2f}")
print(f"death per cases %{((d/(c*1000000))*100):.2f}")
"""
Example output:
sweden: pop 10.35mil, cases 2.523404mil, deaths 19100
death per popul %0.18
death per cases %0.76
@cyphunk
cyphunk / questions.json
Last active February 19, 2023 21:58
questions.json
[
{
"question":
{
"en": "What percentage of refugees today (worldwide) are from European ex-colonies?",
"de": "Wieviel Prozent der weltweiten Geflüchteten heutzutage kommen aus europäischen Ex-Kolonien?"
},
"options":
[
{ "en": "12%", "de": "12%" },
@cyphunk
cyphunk / make-keinanzeigen-usable.js
Last active January 31, 2023 11:18
make-keinanzeigen-usable.js
// ==UserScript==
// @name make ebay keinanzeigen usable
// @namespace github.com/cyphunk
// @version 1970.1.1
// @match https://*.ebay-kleinanzeigen.de/*
// @run-at document-end
// @grant none
// @author cyphunk
// @icon https://ebay-kleinanzeigen.de//favicon.ico
// @description make ebay keinanzeigen usable. attempts to fade duplicates and items you have already seen once. has a high false possitive rate with current configuration where an item is keyed by only zipcode and price. I'd rather have higher false-positives and have adverts I miss then see an advert reposted with just a different title. This can bechanged though, see code below to change 'TAG'
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cyphunk
cyphunk / rough_colonies_shapes.geojson
Last active January 21, 2023 11:05
(not mine. sourced from facq berlin)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.