Skip to content

Instantly share code, notes, and snippets.

View ianfitzpatrick's full-sized avatar

Ian Fitzpatrick ianfitzpatrick

View GitHub Profile
@ianfitzpatrick
ianfitzpatrick / query.py
Last active April 16, 2024 08:17
Orphaned Public List Notifications
from notifications.constants import NOTIFY_UPDATE
from lists.models import List
from lists.permissions.permissions import can_read_wishlist_via_shared_group
list_ids = List.objects.filter(privacy_level=List.PUBLIC).values_list('id', flat=True)
objs = Notification.objects.filter(sub_type=NOTIFY_UPDATE, object_id__in=list_ids)
# Result: 553,742 notifications, not yet filtered on owner's access
problem_objs = []
@ianfitzpatrick
ianfitzpatrick / troubleshooting.txt
Created April 11, 2024 20:46
Troubleshooting Steps for EYK SSH
As a reminder:
> git remote -v
eyk-stag ssh://git@eyk-builder.giftster-us-east-2.giftster.ey.io:2222/giftster-app-staging.git (fetch)
eyk-stag ssh://git@eyk-builder.giftster-us-east-2.giftster.ey.io:2222/giftster-app-staging.git (push)
----
❯ git push eyk-stag dev
@ianfitzpatrick
ianfitzpatrick / fetch.sql
Last active March 13, 2024 06:26
fetch sql data
INSERT INTO `fetch_matchdomain` (`id`, `currency_symbol`, `domain_name`, `priority`, `region`, `description`, `notes`, `provider_id`, `exact_match`)
VALUES
(1, X'24', X'616D617A6F6E2E636F6D', 1, X'5553', X'416D617A6F6E2E636F6D205553', X'', 2, NULL),
(5, X'24', X'616D617A6F6E2E6361', 1, X'4341', X'416D617A6F6E2043616E616461', X'', 2, NULL),
(6, X'C2A3', X'616D617A6F6E2E636F2E756B', 1, X'554B', X'416D617A6F6E20556E69746564204B696E67646F6D', X'', 2, NULL),
(7, X'E282AC', X'616D617A6F6E2E6465', 1, X'4445', X'416D617A6F6E204765726D616E79', X'', 2, NULL),
(8, X'24', X'7777772E746F79737275732E636F6D', 1, X'', X'546F79732052205573', X'546F7973205220557320697320626C6F636B696E672064696666626F742C20736F20747279696E67207769746820456D6265642E6C7920666F722061207768696C65202031312F3230206261636B20746F2064696666626F742063616E20676574207072696365', 3, NULL),
(11, X'24', X'666F6F746C6F636B65722E636F2E756B', 1, X'', X'', X'', 3, NULL),
(12, X'24', X'7777772E6C65626F7264656C646567656F7267657474652E636F6D', 1, X'', X'', X'
@ianfitzpatrick
ianfitzpatrick / orphaned_group_notifications.py
Last active April 16, 2024 03:11
Find Orphaned Group Notifications
# Find orphaned group invite/request notifications
from notifications.constants import NOTIFY_INVITE, NOTIFY_REQUEST
objs = Notification.objects.filter(sub_type__in=[NOTIFY_INVITE, NOTIFY_REQUEST], updated_on__range=['2021-01-01', '2021-12-31'])
problem_objs = []
for obj in objs:
if not obj.owner.id in obj.content_object.memberships.all().values_list('user__id', flat=True):
problem_objs.append(obj)
# Mass delete orphaned group invite/request notifications
@ianfitzpatrick
ianfitzpatrick / EYK_new_admin_user.md
Created January 26, 2024 01:56
EYK New Admin User Setup
@ianfitzpatrick
ianfitzpatrick / language_acq.txt
Created October 1, 2019 17:26
Language Acquisition
Three background things:
1. Stephen Krashen’s Theory of Second Language Acquisition:
https://www.sk.com.br/sk-krash-english.html
Pretty much boils down to:
- Excessive-self monitoring and learning via grammar-first (see: duolingo) makes language acquisition way harder.
- We learn language via comprehensible input, “i + 1”, you need to find input that is + 1 past what you already know
- Stress, doubt, and basically being afraid to fuck up also kill language acquisition.
Here’s a lecture on his theories if you are interested: https://www.youtube.com/watch?v=t3lv7ExApHM&t=101s
Edit: Actually, this may be a better video. I’m having trouble finding one where he succinctly goes through his theories:
https://www.youtube.com/watch?v=Xn2k8I8by8o

How To Start Twitter Botting -- The Boring Parts

The boring parts of standing up a twitter bot I always forget. This guide should get you from "I got absolutely nothing" to "I posted a thing to twitter with Python!"

Here's the deal. If you make a bunch of bot accounts, and all those accounts are tied to one cell phone number, you are in for a round of API access recovation musical chairs.

To get around this, you need to create your own central twitter app. This app will in turn then be used by all your bot accounts. This app will be tied to your main account, backed by your phone number.

1. Create a Twitter Dev Account

@ianfitzpatrick
ianfitzpatrick / perlin_terrain_map.pyde
Last active January 23, 2018 05:33
Perlin Terrain Map from Nature of Code book ported to python mode for processing
w = 1400
h = 1000
scl = 20
flying = 0
terrain = []
def setup():
global terrain, rows, cols
size(600, 600, P3D)
cols = w / scl
@ianfitzpatrick
ianfitzpatrick / walker_es6.js
Last active July 7, 2017 21:13
walker_es6.js
// The Nature of Code
// Daniel Shiffman
// http://natureofcode.com
let walker
function setup() {
createCanvas(640,360)
walker = new Walker()
background(127)
{
"vaguely racist": "racist",
"specter of race": "racism",
"white nationalist": "white supremacist",
"white nationalists": "white supremacists",
"white nationalism": "white supremacy",
"climate skeptic": "climate denier",
"climate change skeptic": "climate change denier",
"climate change skeptics": "climate change deniers",
"climate contrarian": "climate denier",