Skip to content

Instantly share code, notes, and snippets.

View WardBenjamin's full-sized avatar

Benjamin Ward WardBenjamin

View GitHub Profile
@kskrueger
kskrueger / DiscordAnalysis.py
Last active August 1, 2021 12:20
Analyze discord usage
import json
import csv
from datetime import date
import numpy as np
from glob import glob
from matplotlib import pyplot as plt
join_date = date(2017, 8, 3)
path_to_package_directory = "/Users/kskrueger/PycharmProjects/DiscordLearning/Personal/package-2/"
@jamalex
jamalex / notion_task_manager.py
Created January 17, 2019 07:14
Notion task manager toy example
import datetime
import random
import time
from multiprocessing import Lock
from notion.client import *
from notion.block import *
mutex = Lock()
@lummie
lummie / FileServerWith404.go
Last active February 24, 2023 22:46
A wrapper for GOs http.FileServer that allows a custom 404 handler to be assigned
package middleware
import (
"net/http"
"os"
"path"
"strings"
)
// FSHandler404 provides the function signature for passing to the FileServerWith404
@brian-armstrong-discord
brian-armstrong-discord / lilliput-bench.txt
Created November 7, 2017 19:59
Lilliput vs. Pillow-simd
Setup: Intel Haswell, Debian. Both tests ran against the same image libraries (libjpeg-turbo etc).
Both ran on a single thread only. Save qualities were 85 for JPEG and WEBP, compress level 7 for PNG.
Both tests ran many iterations and then averaged results.
Benchmarking code can be found at https://github.com/discordapp/lilliput-bench
Test types:
- Header reading: We don't actually know what's in a blob of image bytes when we get it. Reading the header allows us
to decide if we want to resize the image.
- Resize, 256x256 => 32x32: We have lots of icon-sized assets that we need resized into various smaller formats.
These make up a pretty sizable percentage of our resizes.
@Prajjwal
Prajjwal / ephemeral-file-sharing-services.md
Last active May 26, 2024 10:11
A List of Ephemeral File Sharing Services

A List of Ephemeral File Sharing Services

Contributions welcome.

~ Prajjwal Singh

Service CLI? Max Size Direct Access Files Expire? Can Limit Download Count? Password Protection HTTPS
c-v.sh curl -F 4 GB Yes Yes, by Mister Alg. No No Enforced
FileIO Yes 5 GB Yes Optionally Fixed @ 1 No Yes
@kosyfrances
kosyfrances / heroku_database_copy.md
Last active March 15, 2023 09:50
To copy heroku database from one app to another and from local to heroku

To copy database from one heroku app to another -

heroku pg:backups capture [database_name]
heroku pg:backups restore $(heroku pg:backups public-url --app source_app) DATABASE_URL --app target_app

You can refer to https://devcenter.heroku.com/articles/heroku-postgres-backups for more information.

To copy database from local to heroku - Dump your local database in compressed format using the open source pg_dump tool: PGPASSWORD=mypassword pg_dump -Fc --no-acl --no-owner -h localhost -U myuser mydb > mydb.dump where myuser is your database username and mydb is the database name.

@robnyman
robnyman / image-data-url-localStorage.js
Created February 21, 2012 08:29
Turn image into Data URL and save in localStorage
// Get a reference to the image element
var elephant = document.getElementById("elephant");
// Take action when the image has loaded
elephant.addEventListener("load", function () {
var imgCanvas = document.createElement("canvas"),
imgContext = imgCanvas.getContext("2d");
// Make sure canvas is as big as the picture
imgCanvas.width = elephant.width;