Skip to content

Instantly share code, notes, and snippets.

View hallazzang's full-sized avatar

Hanjun Kim hallazzang

  • MilkyWay
  • Seoul, Republic of Korea
  • 14:50 (UTC +09:00)
View GitHub Profile
@hallazzang
hallazzang / coolsms_send_sms.go
Created June 24, 2018 12:21
[Go] Send SMS message with CoolSMS API
package main
import (
"crypto/hmac"
"crypto/md5"
"crypto/rand"
"encoding/hex"
"encoding/json"
"errors"
"fmt"
table_structure = [
[('A', 3, 1), ('B', 1, 2), ('C', 3, 1)],
[('D', 1, 1), ('E', 2, 1)],
[('F', 2, 1)],
[('G', 1, 2), ('H', 1, 2)],
]
total_cols = sum(x[2] for x in table_structure[0])
table = [[None]*total_cols for _ in range(len(table_structure))]
import sys
import pygame
from pygame.locals import *
SCREEN_WIDTH, SCREEN_HEIGHT = 640, 480
pygame.init()
screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
@hallazzang
hallazzang / suppress_insecure_request_warning.py
Created February 26, 2018 18:10
How to suppress InsecureRequestWarning from urllib3
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
@hallazzang
hallazzang / privates_example.py
Created January 31, 2018 12:32
Private variables in Python: dark magic
from collections import defaultdict
def is_private_name(name):
return not name.startswith('__') and name.startswith('_')
class InstanceProxy:
def __init__(self, instance, privates):
self._instance = instance
self._privates = privates
@hallazzang
hallazzang / README.md
Created November 30, 2017 07:43
Deploy JSP website using Docker + Apache Tomcat from scratch(without IDEs like Eclipse, IntelliJ, etc.)

Docker + Apache Tomcat + JSP

This article describes how to deploy a JSP website using Docker, Apache Tomcat.

Directory structure

I found a way to make a minimal JSP web application from scratch, without any IDE. (ref: https://www.youtube.com/watch?v=JEBR_KJdzSk)

First, organize your working directory like this:

@hallazzang
hallazzang / README.md
Last active August 8, 2022 09:19
Example of how to implement throttling in Asyncio/Aiohttp

Example of how to implement throttling in Asyncio/Aiohttp

This gist consists of 4 files:

throttler.py - Throttler class implementation
asyncio_throttling_example.py - Throttling general coroutines
aiohttp_throttling_example_client.py - Throttling aiohttp requests
aiohttp_throttling_example_server.py - Web server for testing aiohttp_throttling_example_client.py
@hallazzang
hallazzang / method_overloading.py
Last active August 7, 2017 06:24
How to implement method overloading using metaclass.
import inspect
from itertools import islice
class MethodList(list):
pass
class OverloadingClassDict(dict):
def __setitem__(self, name, value):
if callable(value) and name in self:
old_value = self[name]
@hallazzang
hallazzang / README.md
Created April 14, 2017 14:00
Convert HWP file to HTML using pyhwp

Programmatically convert HWP file to HTML using pyhwp5

Dependencies

  • lxml
  • pyhwp

Requirements

  • hwp5html.xsl
@hallazzang
hallazzang / Matrix.java
Created April 10, 2017 07:57
Simple Java matrix class implementation
public class Matrix {
private double[][] data = null;
private int rows = 0, cols = 0;
public Matrix(int rows, int cols) {
data = new double[rows][cols];
this.rows = rows;
this.cols = cols;
}