Skip to content

Instantly share code, notes, and snippets.

@snydergd
snydergd / paywallRemover.js
Last active July 8, 2023 20:28
Paywall Remover Script
/*
A quick and dirty javascript to paste in devtools (F12 in browser) console to remove client-side paywalls
After running, you'll have a "hide" button you can press to get rid of the currently displayed paywall/overlay.
You may need to press it several times.
You'll also have a "close" button to hide the buttons.
If you want to use on Android/Chrome, you can! Use the following abbreviated version. Add as a bookmark
(will have to manually re-add the "javascript: " at the front) then launch by typing the name of the bookmark
in the address bar and pressing on it (clicking from the bookmark section does not work). I named my bookmark
@snydergd
snydergd / nickelodeonuniverse.com-rides-scrape.py
Created June 21, 2021 16:39
Scrape ride information from Mall of America Nickelodeon Universe website, and put into a CSV using Selenium in python.
from selenium import webdriver
from selenium.common.exceptions import ElementNotInteractableException
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.remote.webelement import WebElement
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.common.keys import Keys
import csv
driver = webdriver.Chrome()
@snydergd
snydergd / calendar.css
Last active October 9, 2020 04:17
Minimal Calendar
.minCal {
display: inline-table;
padding: 0.5em;
text-align: center;
width: 100%;
border: 1px solid black;
padding: 0;
background-color:white;
color: black;
}
@snydergd
snydergd / tcpDump.groovy
Created June 11, 2019 02:57
TCP Dumper Groovy
/*
Quick and dirty way to see raw requests made, for debugging.
*/
import java.net.ServerSocket
def server = new ServerSocket(4444)
while(true) {
server.accept { socket ->
socket.withStreams { input, output ->
byte[] buf = new byte[256]
@snydergd
snydergd / dumpHttp.groovy
Created June 11, 2019 01:46
HTTP Dumper
import com.sun.net.httpserver.HttpServer
HttpServer.create(new InetSocketAddress(8899), 0).with {
createContext("/") { http ->
http.with {
println (requestMethod + " " + requestURI + " HTTP/1.1")
requestHeaders.each{
a,b -> b.each{
y -> println a + ": " + y
}
@snydergd
snydergd / hexDump.py
Created September 26, 2018 21:17
Python hex dump snippet
#!/bin/env python
import sys
import string
while True:
b = sys.stdin.read(16)
if not b:
break
print "".join(map(lambda x: "%02x " % x, map(ord, b))) + " " + "".join(map(lambda x: x if x in string.printable else chr(0xA7), b)).replace('\t',' ')
@snydergd
snydergd / uniqueFolderFinder.py
Created July 22, 2018 23:42
Just some experimentation that I wanted to save. No point to make it private.
"""
Looking for a way to reduce a list of 9 digits into a sum that is unique if the digits are those between 1 and 9 inclusively.
This is for a solution to a Sudoku problem, but it was fun to mess around with functional programming.
"""
import itertools, functools, inspect
def findAllSimilar(individualOperation, aggregationOperation):
# Note: doing range inverse to make sure operation is commutative
expected = functools.reduce(aggregationOperation, map(individualOperation, range(9, 0, -1)))
#!/usr/bin/env node
var tty = require('tty')
var readline = require('readline')
var util = require('util')
// Config
var keyBindings = {
"C-x": "quit",
"C-r": "draw-screen",
@snydergd
snydergd / dateCopy.html
Created December 13, 2016 15:02
Entering a lot of dates as text? This little snippet lets you quickly pick a date and have it copied to the clipboard in a custom format. Relies on moment.js
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Date select copy</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.17.1/moment.min.js"></script>
<script type="text/javascript">
if (typeof($) == "undefined") {
$ = document.getElementById.bind(document);
}
@snydergd
snydergd / findObjProperty.js
Created September 1, 2016 03:58
Javascript Cyclic Nested Object Property Search
/*
* Finds locations within data structure that a specific key/value can be found
* - Handles looping data structures (for instance window.window = window)
* - Flexible query format (provide key to match, value to match, or both)
* - Handy for reverse engineering and understanding javascript code on websites
* - Note, it's a little hack-ish, but it's just a tool anyway
* Examples:
* a = {b: 4, c: [1, 2, {d: 5, e: [0, 5, 2]}]};
* searchObj(a, {key: d}); // --> ["root.c.2.d"]
* searchObj(a, {value: 2}); // --> ["root.c.1", "root.c.2.e.2"]