Skip to content

Instantly share code, notes, and snippets.

@haedaal
haedaal / Dockerfile
Created June 30, 2022 04:43
#docker #timezone
RUN apt-get install tzdata
RUN ln -sf /usr/share/zoneinfo/Asia/Seoul /etc/localtime
@haedaal
haedaal / enum_test.json
Created March 20, 2021 09:32
enum test spec for openapi generator
{
"components": {
"examples": {},
"headers": {},
"parameters": {},
"requestBodies": {},
"responses": {},
"schemas": {
"BooleanEnum": {
"enum": ["true", "false"],
@haedaal
haedaal / join_df.py
Created October 9, 2019 03:12
#python #pandas #join #csv
import pandas as pd
instruction_address = pd.read_csv('Untitled', sep='\t', names=['addr', 'instr'])
iperf = pd.read_csv('imagenet_224x224_mobilenet_v1_uint8_quantization-aware-trained_dm_1.0_without_softmax.0_$0.csv')
icore = iperf.groupby(['instruction_index', 'instruction']).sum().drop(['mac_cycle'], axis=1)
icore.cycle = icore.cycle.astype('int32')
instruction_address['estimated_cycle'] = icore.reset_index().cycle
instruction_address.addr = instruction_address.addr.astype('int32')
@haedaal
haedaal / docker-tag-push.sh
Created September 3, 2019 05:25
#docker #tag #push
#!/bin/bash
if [ -z $1 ]; then
echo './docker-tag-push $IMAGE $TAG $REMOTE_TAG' >&2
exit 1
fi
# login ECR
`aws ecr get-login --no-include-email --region ap-northeast-2`
@haedaal
haedaal / make_excel_with_js_tflite.js
Created September 3, 2019 01:18
excel generation with javascript #excel #xlsx #js #javascript #cli #tflite #tensorflow
var fs = require("fs");
var obj = JSON.parse(fs.readFileSync("./ssd.json", "utf8"));
let opcodes = obj["operator_codes"];
opcodes;
let subgraph = obj.subgraphs[0];
let ops = subgraph.operators;
let tensors = subgraph.tensors;
let headers = [["op", "tensor shape", "kernel size", "stride"]];
@haedaal
haedaal / chart_draw_in_cli.py
Created September 2, 2019 08:31
chart draw in cli
import seaborn as sns
import matplotlib.pyplot as plt
import matplotlib
import numpy as np
import pandas as pd
matplotlib.use('Agg')
sns.set()
num_slices = perf.num_slice.unique()
@haedaal
haedaal / prebuild.js
Last active April 15, 2018 04:50
git head hash tag version javascript
// automatic script build number management
const fs = require('fs');
const moment = require('moment-es6').default;
let childProcess = require('child_process')
let file = './build-info.ts'
if (process.argv.some(arg => arg === '--postbuild')) {
console.log('reset build number..')
let buf = fs.readFileSync(file, { encoding: 'utf-8' })
@haedaal
haedaal / make-swap-memory
Last active April 15, 2018 04:51
memory, .. cpu?
# We can see if the system has any configured swap by typing:
# sudo swapon --show
You can verify that there is no active swap using the free utility:
# free -h
Before we do this, we should check the current disk usage by typing:
@haedaal
haedaal / nginx
Last active April 15, 2018 04:53
nginx
curl -fsSL https://nginx.org/keys/nginx_signing.key | sudo apt-key add -
sudo sh -c 'echo "deb http://nginx.org/packages/ubuntu/ xenial nginx" >> /etc/apt/sources.list'
sudo sh -c 'echo "deb-src http://nginx.org/packages/ubuntu/ xenial nginx" >> /etc/apt/sources.list'
sudo apt-get update
sudo apt-get install -y nginx
sudo service nginx start
@haedaal
haedaal / ssl-certbot
Last active April 15, 2018 04:53
setup ssl cert with certbot (on ubuntu xenial)
sudo apt-get update
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo apt-get install python-certbot-nginx