Skip to content

Instantly share code, notes, and snippets.

View simonseo's full-sized avatar

Simon Seo simonseo

  • Carnegie Mellon University
  • Pittsburgh, PA
View GitHub Profile
@simonseo
simonseo / kakao_to_ical.py
Created July 31, 2023 21:27
Kakao calendar birthdays to iCal/ics
# events.json https://calendar.kakao.com/web/events?from=20230625T000000Z&to=20240624T235959Z&birthday=true&referer=month
# friends.json https://calendar.kakao.com/web/talk/friends
cal_template = """BEGIN:VCALENDAR
PRODID:-//Talk Calendar//iCal4j 2.0//EN
VERSION:2.0
CALSCALE:GREGORIAN
X-WR-CALNAME:
{}
END:VCALENDAR
@simonseo
simonseo / articles.txt
Last active May 11, 2022 18:00
Random Articles
Joplo Bartu
From Wikipedia, the free encyclopedia
Jump to navigationJump to search
Joplo Bartu
refer to caption
Bartu at University of Phoenix Stadium in 2016
Personal information
Born: October 3, 1989 (age 32)
Seattle, Washington
Height: 6 ft 2 in (1.88 m)
@simonseo
simonseo / ec2-host-from-tag-to-env-vars.sh
Created April 15, 2020 17:59 — forked from marcellodesales/ec2-host-from-tag-to-env-vars.sh
Create Environment Variables in EC2 Hosts from EC2 Host Tags, just like Beanstalk or Heroku does!
######
# Author: Marcello de Sales (marcello.desales@gmail.com)
# Description: Create Create Environment Variables in EC2 Hosts from EC2 Host Tags
#
### Requirements:
# * Install jq library (sudo apt-get install -y jq)
# * Install the EC2 Instance Metadata Query Tool (http://aws.amazon.com/code/1825)
#
### Installation:
# * Add the Policy EC2:DescribeTags to a User
# examples from https://realpython.com/primer-on-python-decorators/
import time
import functools
import random
######### Common decorators #########
def timer(func):
"""Print the runtime of the decorated function"""
@functools.wraps(func)
def wrapper_timer(*args, **kwargs):
@simonseo
simonseo / fastcampus_scraper.py
Created March 18, 2020 13:25
패스트캠퍼스 강좌를 다운로드 받기 위한 스크레이퍼
#!/usr/bin/python
# -*- coding: utf-8 -*-
# @File Name: scrapper.py
# @Created: 2020-03-18 02:57:12 Simon Myunggun Seo (simon.seo@nyu.edu)
# @Updated: 2020-03-18 17:08:14 Simon Seo (simon.seo@nyu.edu)
import sys, time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
@simonseo
simonseo / remove_ensure_ascii.py
Created February 13, 2019 08:43
Converts UTF-8 characters that were encoded in ASCII compatible '\uXXXX' format to non-ASCII characters
import json, codecs
input_filename = "message.json"
output_filename = "message_new.json"
with codecs.open(input_filename, 'r', encoding='utf-8') as infile:
with codecs.open(output_filename, 'w', encoding='utf-8') as outfile:
json.dump(json.load(infile), outfile, ensure_ascii=False)
@simonseo
simonseo / fix_latin1_utf8_mojibake.py
Created February 13, 2019 08:42
Fixes UTF-8 files that are wrongly encoded into Latin-1
import json, codecs, re
from functools import partial
input_filename = "message.json"
output_filename = "message_new.json"
fix_mojibake_escapes = partial(
re.compile(rb'\\u00([\da-f]{2})').sub,
lambda m: bytes.fromhex(m.group(1).decode()))
@simonseo
simonseo / createM3U.py
Created April 3, 2018 20:46
Creates .m3u from all mp3 files in the current directory
# createM3U.py
# Creates .m3u from current directory
# Dependencies: mutagen
# Usage: put this script in a folder that has mp3 files. run in console like so:
# $ python3 createM3U.py
# or
# $ python3 createM3U.py <path to mp3s>
from mutagen.id3 import ID3
from mutagen.mp3 import MP3