Skip to content

Instantly share code, notes, and snippets.

View allen-munsch's full-sized avatar
⁉️

James allen-munsch

⁉️
View GitHub Profile
@allen-munsch
allen-munsch / 3d-ux.js
Created February 26, 2024 14:57
quick 3js example of directory tree file browsing
// Import Three.js
import * as THREE from "three";
import { OrbitControls } from "three/addons/controls/OrbitControls";
var scene = new THREE.Scene();
var camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
var renderer = new THREE.WebGLRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);
@allen-munsch
allen-munsch / list-installed.py
Created February 2, 2024 20:53
list all installed packages using importlib python
import importlib.metadata
def list_installed_packages():
distributions = importlib.metadata.distributions()
installed_packages = []
for dist in distributions:
args = (dist.metadata['Name'], dist.version)
installed_packages.append(args)
installed_packages.sort() # Sort the packages by name
for package_name, version in installed_packages:
@allen-munsch
allen-munsch / another-example.md
Last active November 28, 2023 17:35 — forked from JamesChevalier/lambda_function.py
How to install lxml in Amazon Lambda
sudo yum install update
sudo yum groupinstall -y "Development Tools"
sudo yum install -y python-devel libpng-devel freetype-devel gcc72-c++

If you want to use docker, you can use the following command:

 docker run -it lambci/lambda:build-python3.7 bash
@allen-munsch
allen-munsch / clear-gcp.sh
Last active October 22, 2023 05:13
generate a list of resources to destroy in google cloud project
#!/bin/bash
set -eux
# Thanks to: https://github.com/paulczar/gcp-cleaner/blob/master/delete-all.sh
export __region=$1
FAIL=0
waitfor() {
@allen-munsch
allen-munsch / OpenBazaar-moderator-policies.md
Created September 19, 2018 04:32
OpenBazaar-moderator-policies.md
@allen-munsch
allen-munsch / gtk.css
Created November 24, 2020 21:48
decrease the size of gnome terminal / gtk3 window title and window tabs
/* Decrease the tabs bar height in gnome-terminal
* Add: ~/.config/gtk-3.0/gtk.css
* See: https://stackoverflow.com/questions/36869701/decrease-the-tabs-bar-height-in-gnome-terminal
*/
terminal-window notebook > header.top button {
padding: 0 0 0 0;
background-image: none;
border: 0;
margin-right: 10px;
@allen-munsch
allen-munsch / homebrew.mxcl.dnsmasq.plist
Last active December 3, 2020 18:54
Disable ad networks, disable firefox popups, disable other sketchy stuff : macosx
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>homebrew.mxcl.dnsmasq</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/opt/dnsmasq/sbin/dnsmasq</string>
<string>--keep-in-foreground</string>
@allen-munsch
allen-munsch / common_crawl.sh
Created October 13, 2018 16:14
simple common crawl curl bash example for wat, and warc
#!/bin/bash
function search_indexes() {
declare -a indexes=(/CC-MAIN-2018-39-index /CC-MAIN-2018-34-index /CC-MAIN-2018-30-index /CC-MAIN-2018-26-index /CC-MAIN-2018-22-index /CC-MAIN-2018-17-index /CC-MAIN-2018-13-index /CC-MAIN-2018-09-index /CC-MAIN-2018-05-index /CC-MAIN-2017-51-index /CC-MAIN-2017-47-index /CC-MAIN-2017-43-index /CC-MAIN-2017-39-index /CC-MAIN-2017-34-index /CC-MAIN-2017-30-index /CC-MAIN-2017-26-index /CC-MAIN-2017-22-index /CC-MAIN-2017-17-index /CC-MAIN-2017-13-index /CC-MAIN-2017-09-index /CC-MAIN-2017-04-index /CC-MAIN-2016-50-index /CC-MAIN-2016-44-index /CC-MAIN-2016-40-index /CC-MAIN-2016-36-index /CC-MAIN-2016-30-index /CC-MAIN-2016-26-index /CC-MAIN-2016-22-index /CC-MAIN-2016-18-index /CC-MAIN-2016-07-index /CC-MAIN-2015-48-index /CC-MAIN-2015-40-index /CC-MAIN-2015-35-index /CC-MAIN-2015-32-index /CC-MAIN-2015-27-index /CC-MAIN-2015-22-index /CC-MAIN-2015-18-index /CC-MAIN-2015-14-index /CC-MAIN-2015-11-index /CC-MAIN-2015-06-index /CC-MAIN-2014-52-index /CC-MAIN-2014-49
@allen-munsch
allen-munsch / django_middleware_wrapper.py
Created July 10, 2020 02:00
fastapi, starlette middleware wrapper for existing django middleware [broken]
from uuid import uuid4
from django.http import HttpRequest, QueryDict
from django.middleware.csrf import CSRF_SESSION_KEY
from django.utils.datastructures import MultiValueDict
from fastapi import FastAPI
from fastapi.middleware.wsgi import WSGIMiddleware
from starlette.middleware import Middleware
from starlette.middleware.base import BaseHTTPMiddleware
from starlette.middleware.sessions import SessionMiddleware
@allen-munsch
allen-munsch / example.py
Last active January 13, 2020 18:39
python popen example
stdout = lambda x: sys.stdout.write(x + '\n')
stderr = lambda x: sys.stderr.write(x + '\n')
def sanitize_output(output):
output = re.sub(
r"[\"']?password[\"']?: ['\"a-z0-9A-Z]+", "'password': '###'", output
)
output = re.sub(