Skip to content

Instantly share code, notes, and snippets.

View james-see's full-sized avatar
🍀
make your own luck

JC james-see

🍀
make your own luck
View GitHub Profile
@james-see
james-see / email.py
Last active April 20, 2022 22:21
The best email parser on the planet. Email extraction. You are welcome world.
import re
def finder(stringer):
EMAIL_REGEX = re.compile("(?:[a-zA-Z0-9!#$%&'*+\-\/\=?^_`{|}~]|\.(?!\.)){1,64}@(?:(?:[a-zA-Z0-9\-]){1,63}\.(?!\.)){1,4}(?:[a-zA-Z0-9]{2,12})")
emails = EMAIL_REGEX.findall(stringer)
return emails
@james-see
james-see / get-status.sh
Created December 16, 2019 21:42
how to quickly get head status of each url for onion sites
#!/bin/bash
while read LINE; do
curl -o /dev/null --silent --socks5-hostname 127.0.0.1:9050 --head --write-out "%{http_code} $LINE\n" "$LINE"
done < url-list.txt

How to setup a practically free CDN using Backblaze B2 and Cloudflare

⚠️ Note 2023-01-21
Some things have changed since I originally wrote this in 2016. I have updated a few minor details, and the advice is still broadly the same, but there are some new Cloudflare features you can (and should) take advantage of. In particular, pay attention to Trevor Stevens' comment here from 22 January 2022, and Matt Stenson's useful caching advice. In addition, Backblaze, with whom Cloudflare are a Bandwidth Alliance partner, have published their own guide detailing how to use Cloudflare's Web Workers to cache content from B2 private buckets. That is worth reading,

@jarek-przygodzki
jarek-przygodzki / rob-pike-comments.md
Last active August 5, 2024 17:04
Rob Pike on commnts

Comments

A delicate matter, requiring taste and judgement. I tend to err on the side of eliminating comments, for several reasons. First, if the code is clear, and uses good type names and variable names, it should explain itself. Second, comments aren't checked by the compiler, so there is no guarantee they're right, especially after the code is modified. A misleading comment can be very confusing. Third, the issue of typography: comments clutter code.

Rob Pike, "Notes on Programming in C"

@james-see
james-see / PYPI-forget-me-not.md
Last active November 18, 2019 19:00
Forget me not file for how to get packages into PYPI

Want to make your python script / app into a pip installable package? So did I, and I keep forgetting when I need to update the versions.

I maintain IPTCInfo3, spry, itunizer, and riskroller.
Make sure to have a setup.py file that is formatted similar to this:

import setuptools

with open("README.md", "r") as fh:
    long_description = fh.read()
@AlinaNova21
AlinaNova21 / README.md
Last active June 22, 2021 21:01
Rancher 2.0, RKE, and some Raspberry Pi 3s

Kubernetes and Arm

Getting rke and Rancher setup to run kubernetes on arm is interesting. There is no official support yet via rancher, although there is interest and some work done towards those efforts. This is my attempt at getting a cluster of 3 Pis (2 3Bs and 1 3B+) provisioned and registered to a rancher 2 server.

Prep

I've successfully completed this both with Hypriot OS 1.9.0 and the arm64 builds https://github.com/DieterReuter/image-builder-rpi64 Both times I used the same basic cloud-init setup

@matthewearl
matthewearl / smblevextract.py
Last active February 21, 2025 03:24
Super Mario Bros Level Extractor
#!/usr/bin/env python3
#
# Copyright (c) 2018 Matthew Earl
#
# 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
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
"""
Configuration example for ``ptpython``.
Copy this file to ~/.ptpython/config.py
"""
from __future__ import unicode_literals
from prompt_toolkit.filters import ViInsertMode
from prompt_toolkit.key_binding.input_processor import KeyPress
from prompt_toolkit.keys import Keys
from pygments.token import Token

Disable Device Enrollment Notification on Mac.md

Restart the Mac in Recovery Mode by holding Comment-R during restart

Open Terminal in the recovery screen and type

csrutil disable