Skip to content

Instantly share code, notes, and snippets.

View cincodenada's full-sized avatar

Ell Bradshaw cincodenada

View GitHub Profile
@cincodenada
cincodenada / apt-tree
Last active November 4, 2024 22:38 — forked from blais/apt-tree
apt-tree
#!/usr/bin/env python3
"""Display a graph of dependencies between Ubuntu packages.
Reads a list of packages from either a file or stdin.
Outputs a PDF.
"""
__author__ = "Martin Blais <[email protected]>"
import argparse
import logging
import random
@cincodenada
cincodenada / esm-package.md
Last active October 19, 2022 00:42 — forked from sindresorhus/esm-package.md
Pure ESM package

Pure ESM package

The package that linked you to this page is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@cincodenada
cincodenada / geonames.py
Created April 7, 2017 01:15 — forked from pamelafox/geonames.py
Geonames Python wrapper
import sys
import urllib
import urllib2
import json
import logging
class GeonamesError(Exception):
def __init__(self, status):
@cincodenada
cincodenada / save_body.py
Last active February 27, 2016 15:32 — forked from mhils/save_body.py
Update for new API
from libmproxy.model import decoded
def response(context, flow):
with decoded(flow.response): # automatically decode gzipped responses.
with open("body.txt","ab") as f:
f.write(flow.response.content)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Country</title>
<meta name="description" content="">
<!-- Mobile-friendly viewport -->