Skip to content

Instantly share code, notes, and snippets.

View bskim45's full-sized avatar

Bumsoo Kim bskim45

View GitHub Profile
@bskim45
bskim45 / I'm a night 🦉
Last active November 17, 2024 00:39
I'm a night 🦉
🌞 Morning 1 commits ▎░░░░░░░░░░░░░░░░░░░░ 1.4%
🌆 Daytime 14 commits ████░░░░░░░░░░░░░░░░░ 19.4%
🌃 Evening 34 commits █████████▉░░░░░░░░░░░ 47.2%
🌙 Night 23 commits ██████▋░░░░░░░░░░░░░░ 31.9%
@bskim45
bskim45 / 💻 Recent coding in languages
Last active September 17, 2024 07:51
💻 Recent coding in languages
Markdown +123/ -64 ████████████▎░░░░░░░░ 58.9%
Ruby +674/ -250 ██▏░░░░░░░░░░░░░░░░░░ 10.3%
Python +962/ -321 ██░░░░░░░░░░░░░░░░░░░ 9.6%
TypeScript +1.0k/ -184 █▋░░░░░░░░░░░░░░░░░░░ 7.9%
JSON +321/ -320 █▌░░░░░░░░░░░░░░░░░░░ 7.2%
YAML +596/ -162 █▏░░░░░░░░░░░░░░░░░░░ 5.5%
TOML +57/ -3 ░░░░░░░░░░░░░░░░░░░░░ 0.5%
JavaScript +6/ -6 ░░░░░░░░░░░░░░░░░░░░░ 0.1%
@bskim45
bskim45 / package.scala
Last active January 8, 2021 16:29
Scala Parallel Collection with parallelism level
/** Parallel Collection with parallelism level
*
* Changes the task support of a parallel collection to use a fork-join pool
* with desired parallelism level
*
* Usage:
* {{{
* Seq(1, 2, 3, 4).par.withCores(Runtime.getRuntime.availableProcessors * 2).map(_ * 2).sum
* }}}
*
@bskim45
bskim45 / redshift_copy.sql
Last active September 20, 2019 09:32
Collection of Redshift Utility Queries
-- Identify how many S3 objects each COPY command loads
SELECT
query, COUNT(*) num_files,
ROUND(MAX(wq.total_exec_time/1000000.0),2) execution_secs,
ROUND(SUM(transfer_size)/(1024.0*1024.0),2) total_mb,
SUBSTRING(querytxt,1,60) copy_sql
FROM stl_s3client s
JOIN stl_query q USING (query)
JOIN stl_wlm_query wq USING (query)
WHERE s.userid>1 AND http_method = 'GET'
@bskim45
bskim45 / pre-receive
Created July 10, 2019 10:26
python + flake8 pre-receive git hook
#!/bin/bash
if test -n "$GIT_PUSH_OPTION_COUNT"
then
i=0
while test "$i" -lt "$GIT_PUSH_OPTION_COUNT"
do
eval "value=\$GIT_PUSH_OPTION_$i"
case "$value" in
force)
@bskim45
bskim45 / APIGateway.md
Last active March 10, 2023 15:41
CloudWatch Logs Insights query for API Gateway

Req id:

parse @message '(*) *' as reqId, message
| filter reqId like "c19dd3fc-5f27-11e9-a823-930d231e2ab8"
| sort @timestamp asc
| limit 50

Status code:

from pynamodb.models import Model
from pynamodb.attributes import UnicodeAttribute, NumberAttribute
class MyModel(Model):
class Meta:
table_name = 'mytable'
group = UnicodeAttribute(hash_key=True)
id = NumberAttribute(range_key=True)
import java.awt.*;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.concurrent.*;
import javax.imageio.ImageIO;
import javax.swing.JComponent;
@bskim45
bskim45 / Team.json.postman_collection
Created November 29, 2017 00:50 — forked from udayms/Team.json.postman_collection
ElasticSearch - Postman Collection to create an Index and insert ~10k records into it.
This file has been truncated, but you can view the full file.
{
"id": "124e573f-bc1b-4d9a-a7ec-c4c17f2095e1",
"name": "Team",
"description": "",
"order": [
"0fa78cfe-0d72-19c6-3ac7-b299a3e95540",
"57194727-54b8-caa3-bb58-c78f0cfcb32f",
"c36dccba-09af-3b85-f3d0-b3bfb925dd59",
"34bea456-2f76-d5ea-f39a-0305ed2bab4e",
"4b5a2548-c9ab-73bb-13d5-e35d256a4e19",
@bskim45
bskim45 / .profile
Created September 10, 2017 09:10 — forked from bmhatfield/.profile
Automatic Git commit signing with GPG on OSX
# In order for gpg to find gpg-agent, gpg-agent must be running, and there must be an env
# variable pointing GPG to the gpg-agent socket. This little script, which must be sourced
# in your shell's init script (ie, .bash_profile, .zshrc, whatever), will either start
# gpg-agent or set up the GPG_AGENT_INFO variable if it's already running.
# Add the following to your shell init to set up gpg-agent automatically for every shell
if [ -f ~/.gnupg/.gpg-agent-info ] && [ -n "$(pgrep gpg-agent)" ]; then
source ~/.gnupg/.gpg-agent-info
export GPG_AGENT_INFO
else