Skip to content

Instantly share code, notes, and snippets.

Avatar

Dustin Ingram di

View GitHub Profile
@di
di / compromised-download-counts.sql
Created August 24, 2022 20:57
BigQuery query to measure download counts of projects compromised by PyPI's phishing attack
View compromised-download-counts.sql
# Using https://packaging.python.org/en/latest/guides/analyzing-pypi-package-downloads/
SELECT
file.project,
file.version,
COUNT(*) AS total_downloads
FROM
`bigquery-public-data.pypi.file_downloads`
WHERE
file.project IN ('exotel',
'spam',
View gist:3c998efc64dece41c0e570b41561845b
starting build "10cc9d38-4ba5-481e-a1a2-a0343996f105"
FETCHSOURCE
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint: git config --global init.defaultBranch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
@di
di / specifiers.py
Created July 15, 2020 20:59
Specifier vs LegacySpecifier analysis
View specifiers.py
import csv
from collections import defaultdict
import packaging.requirements
totals = defaultdict(int)
with open('specifiers.csv') as f:
reader = csv.reader(f)
@di
di / specifiers.py
Created July 15, 2020 20:57
Specifier vs LegacySpecifier analysis
View specifiers.py
This file has been truncated, but you can view the full file.
"Documentation, https://github.com/keystroke3/redpaper/wiki",1
django-notifications-hq (>=1.0),5
"Documentation, https://django-model-revisioning.readthedocs.io",4
"Release Management, https://github.com/pycontribs/a2h/releases",1
trixi-slim (>0.1.2.1) ; extra == 'full',1
thespian (==3.5.2),2
pantsbuild.pants.contrib.node (==1.18.0rc1),1
mailinglogger,3
tabulator (>=1.38),1
smmap (>=0.8.0),2
@di
di / all_versions.sql
Created July 15, 2020 19:55
Version vs LegacyVersion analysis
View all_versions.sql
select
version,
count(version),
max(created) as version_count
from
releases
group by
version
order by
version_count desc;
View gist:0d0b67154ae0ced82c50132de425116b
(env) /tmp $ python --version
Python 2.7.14
(env) /tmp $ python -c "import html"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named html
(env) /tmp $ pip install future
Collecting future
Installing collected packages: future
Successfully installed future-0.17.0
@di
di / app.py
Created October 31, 2016 17:59
simple flask server which receives files and stores them locally
View app.py
import os
from flask import Flask, request
from werkzeug.utils import secure_filename
app = Flask(__name__)
app.config['UPLOAD_FOLDER'] = '.'
@app.route('/', methods=['POST'])
def upload_file():
file = request.files['filedata']
@di
di / coins.py
Created December 4, 2015 15:38
consolidated coins script
View coins.py
import cv2
import numpy as np
img = cv2.imread("coins.png", cv2.IMREAD_GRAYSCALE)
circles = cv2.HoughCircles(
img,
cv2.cv.CV_HOUGH_GRADIENT,
dp=1.5,
minDist=30,
View keybase.md

Keybase proof

I hereby claim:

  • I am di on github.
  • I am dustingram (https://keybase.io/dustingram) on keybase.
  • I have a public key whose fingerprint is 321D E2BA 9BA7 5C06 AF95 53F6 93D2 B8D4 930A 5E39

To claim this, I am signing this object:

@di
di / cheryl.py
Created April 15, 2015 20:57
Chery's Birthday Problem
View cheryl.py
class Date:
def __init__(self, day, month):
self.day = day
self.month = month
def __repr__(self):
return "(%d, %s)" % (self.day, self.month)
dates = [
Date(15, 'may'),
Date(16, 'may'),