Skip to content

Instantly share code, notes, and snippets.

View bskim45's full-sized avatar

Bumsoo Kim bskim45

View GitHub Profile
@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",
@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

Keybase proof

I hereby claim:

  • I am bskim45 on github.
  • I am bskim45 (https://keybase.io/bskim45) on keybase.
  • I have a public key whose fingerprint is 5F9B EE3E 8AE2 8666 03D3 DCF9 24F4 8870 6F28 783F

To claim this, I am signing this object:

@bskim45
bskim45 / pjson.h
Created May 31, 2017 04:03
pjson.h - Super fast JSON parser, with Ensemble-style DOM by Rich Geldreich
// File: pjson.h - written by Rich Geldreich 2012 - License: Unlicense http://unlicense.org/
#ifndef PURPLE_JSON_H
#define PURPLE_JSON_H
#ifdef WIN32
#pragma once
#endif
#include <string>
#include <vector>

Keybase proof

I hereby claim:

  • I am bskim45 on github.
  • I am bskim45 (https://keybase.io/bskim45) on keybase.
  • I have a public key whose fingerprint is 5F9B EE3E 8AE2 8666 03D3 DCF9 24F4 8870 6F28 783F

To claim this, I am signing this object: