Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@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.
@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.
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'
@tiwo
tiwo / rstudio-cc.yml
Created August 28, 2019 00:16 — forked from mdlincoln/rstudio-cc.yml
cloud-config script to setup Rstudio server and Shiny server on Ubuntu 14.04 on Digital Ocean
#cloud-config
# In order to access RStudio server via the web interface, you must log on with
# a user account that allows password access. This script does not add that user
# by default. You may either ssh as root into the server and `adduser` as
# normal, or script a user addition here:
# users:
# - name: # username #
# lock-passwd: false # allow login with password