Skip to content

Instantly share code, notes, and snippets.

Avatar
🏡
Playing catch up!

Mahmoud Hashemi mahmoud

🏡
Playing catch up!
View GitHub Profile
View generator_frame.py
>>> z.gi_frame
<frame object at 0x7f21213b7548>
>>> z.__dict__
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'generator' object has no attribute '__dict__'
>>> z.__slots__
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'generator' object has no attribute '__slots__'
View help.txt
$ python example.py sum --help
Usage: cmd sum [FLAGS]
Just a lil fun in the sum
Flags:
--flagfile FLAGFILE (defaults to None)
--help / -h
View ip_address_notes.md

URLs and IPs

The URL standard is one which builds on IP standards. Operating systems also build on IP standards. Believe it or not, the two diverge in some surprising ways!

Hyperlink aims to do some validation of IPs contained within URLs with IP hosts. URLs support a subset of IP syntax, as well as making affordances for future versions of IPs beyond IPv6 (no matter how unfathomable that may seem).

@mahmoud
mahmoud / mp4_cut.py
Created Jan 6, 2018
a little something i whipped up for cleaner Pyninsula recording cuts
View mp4_cut.py
#!/usr/bin/env python
"""
./cut_mp4.py --input input.mp4 --start 00:00:01 --end 00:00:02 --no-align-keyframes --output output.mp4
"""
import os
import sys
import argparse
import datetime
import subprocess
View postgres_queue_get.sql
DELETE FROM {table_name}
WHERE id = (
SELECT id
FROM {0}
WHERE deliver_after <= now()
AND q_name IN (SELECT unnest({q_names}))
ORDER BY priority DESC, created_at
FOR UPDATE SKIP LOCKED
LIMIT 1
)
View idna_notes.md

idna package notes:

  • If a segment of a host (i.e., something in url.host.split('.')) is
    already ascii, idna doesn't perform its usual checks. For instance,
    capital letters are not valid idna2008. The package automatically lowercases.

You'll get something like:

View percent_decode_notes.md

Intro

urllib.unquote doesn't fit Python's paradigms so well:

unquote(u'%C3')
u'\xc3'
unquote('%C3')
'\xc3'
View 001_commongroups_initial_review.md
View zatoichi.md
title
Zatoichi

Starting on March 26, 2017, I started watching the amazing film series, Zatoichi. ~30 films, 25 of which were released between 1962 and 1973. An astonishing rate, considering these are already some of my favorite films. I didn't start taking notes until I'd seen a few, but here are my brief notes for the majority.

View monumental_deps.txt
monumental@17.7.1 /home/hatnote/monumental
├── angular@1.5.9
├── angular-animate@1.5.9
├── angular-aria@1.5.9
├── angular-file-upload@2.5.0
├── angular-formly@4.2.5
├─┬ angular-leaflet-directive@0.10.0
│ └── leaflet@0.7.7
├── angular-local-storage@0.5.2
├── angular-material@1.1.4