Skip to content

Instantly share code, notes, and snippets.

jsoma /
Last active Jul 27, 2021
A perfect easy beautiful simple way to label a stacked bar chart in Python using pandas/matplotlib. Put this in your Jupyter notebook!
# WAIT!!!
# WAIT!!!
# You probably don't need this any more! Newer versions of matplotlib
# can do this with built-in magic. See these StackOverflow answers:
# Big thanks to @trenton3983 for keeping us all up to date!
JamieCurnow / firestore.ts
Last active Jul 27, 2021
Using Firestore with Typescript
View firestore.ts
* This Gist is part of a medium article - read here:
// import firstore (obviously)
import { firestore } from "firebase-admin"
// Import or define your types
// import { YourType } from '~/@types'
View AWS, ELB, CF and Let's Encrypt
Elastic Load Balancer, CloudFront and Let's Encrypt
amrza /
Last active Jul 27, 2021
How to write RTL(Arabic/Persian) text on images in python.
# Tested on Python 3.6.1
# install: pip install --upgrade arabic-reshaper
import arabic_reshaper
# install: pip install python-bidi
from bidi.algorithm import get_display
# install: pip install Pillow
from PIL import ImageFont
Pusnow / 한글과유니코드.md
Last active Jul 27, 2021
한글과 유니코드
View 한글과유니코드.md

한글과 유니코드

유니코드에서 한글을 어떻게 다루는지를 정리하였다.


  • 유니코드(Unicode)는 전 세계의 모든 문자를 컴퓨터에서 일관되게 표현하고 다룰 수 있도록 설계된 산업 표준 (위키 백과)
  • 단순히 문자마다 번호를 붙임
  • 계속 업데이트되며 현재는 Unicode Version 9.0.0 이 최신이다.


  • 유니코드를 실제 파일 등에 어떻게 기록할 것인지를 표준화한 것이다.
glasslion /
Last active Jul 27, 2021
This script convert youtube subtitle file(vtt) to plain text.
Convert YouTube subtitles(vtt) to human readable text.
Download only subtitles from YouTube with youtube-dl:
youtube-dl --skip-download --convert-subs vtt <video_url>
Note that default subtitle format provided by YouTube is ass, which is hard
to process with simple regex. Luckily youtube-dl can convert ass to vtt, which
is easier to process.
rraval /
Last active Jul 27, 2021
PostgreSQL collation is a massive footgun

This is a slightly stripped down version from our internal bug tracker. The point of posting this publicly is part FYI, part peer review. I'm hoping someone can look at this, disagree, and tell me all the downsides of using the C locale or point out things I've misunderstood. The Recommendations section in particular is contextualized by our database serving a SaaS product for users from many different locales, thus making locale a render level concern. YMMV, caveat emptor, etc.

Collation defines the character ordering for textual data. For Postgres,

The locale settings influence the following SQL features:

  • Sort order in queries using ORDER BY or the standard comparison operators on textual data
  • The upper, lower, and initcap functions
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""This module's docstring summary line.
This is a multi-line docstring. Paragraphs are separated with blank lines.
Lines conform to 79-column limit.
Module and packages names should be short, lower_case_with_underscores.
Notice that this in not
stephenhardy / git-clearHistory
Created Apr 26, 2013
Steps to clear out the history of a git/github repository
View git-clearHistory
-- Remove the history from
rm -rf .git
-- recreate the repos from the current content only
git init
git add .
git commit -m "Initial commit"
-- push to the github remote repos ensuring you overwrite history
git remote add origin<YOUR ACCOUNT>/<YOUR REPOS>.git
raulgarreta /
Created Oct 3, 2016
Simple Python command to get Twitter user followers with the public API.
# -*- coding: utf-8 -*-
import csv
import time
import re
import codecs, cStringIO
from argparse import ArgumentParser
import tweepy