Skip to content

Instantly share code, notes, and snippets.

@tiwo
tiwo / map-zoom.ipynb
Created July 6, 2020 02:21
"Zooming" into a GeoPandas map plot
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tiwo
tiwo / README.md
Last active July 10, 2023 01:13
ppt2jpeg.vbs: Convert Powerpoint slides to JPEG images

ppt2vbs

export a Powerpoint presentation to JPEG images, one per slide. Used as a workaround to the broken JPEG export in Powerpoint itself, which yields only low quality images.

Usage

You can adjust the image resolution by varying the numerical argument in line 46, in the call to ExportSlides.

Just drag and drop one or more PPT or PPTX files onto the vbs script. The script will process each, showing a short message, and

@tiwo
tiwo / object.ipynb
Last active November 27, 2022 06:37
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tiwo
tiwo / Comparison-SQL-Keywords.ipynb
Last active February 15, 2022 23:54
SQL Keywords in different RDBMS
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tiwo
tiwo / concurrentmapwrites.go
Created February 9, 2022 23:33
Golang: fatal error: concurrent map writes
// provoke a crash by cuncurrently writing to the same map from different goroutines
package main
import (
"fmt"
"math/rand"
"sync"
)
@tiwo
tiwo / miserables.ts
Created November 29, 2021 22:35 — forked from korydondzila/miserables.ts
Les Miserables graph data
export default {
"nodes": [
{ "id": "Myriel", "group": 1 },
{ "id": "Napoleon", "group": 1 },
{ "id": "Mlle.Baptistine", "group": 1 },
{ "id": "Mme.Magloire", "group": 1 },
{ "id": "CountessdeLo", "group": 1 },
{ "id": "Geborand", "group": 1 },
{ "id": "Champtercier", "group": 1 },
{ "id": "Cravatte", "group": 1 },
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
from functools import reduce
from operator import mul
try:
from math import prod
except ImportError:
def prod(*C):
return reduce(mul, C, 1)
def convolve(A, B, prod=prod, sum=sum):
"""Convolute A and B (often written A∗B)
#!/usr/bin/env python3
import http.client
import urllib
import argparse
import sys
import logging
logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.DEBUG)
log = logging.getLogger(__name__)
"""
Generating a random token::
>>> random_token() # doctest: +SKIP
10239537334670678660
Signing Tokens (internally, this uses a truncated HMAC)::
>>> key = b'secret'