Skip to content

Instantly share code, notes, and snippets.

View akaz00's full-sized avatar

Byung Suk Yu akaz00

  • Mirim Meister School
  • Seoul
  • X @_akaz
View GitHub Profile
@akaz00
akaz00 / app_s3_test.js
Created April 29, 2023 04:14
s3 upload, download with express (using "@aws-sdk/client-s3")
// s3 버킷 생성은 콘솔에서 진행
// (이름이 전역적으로 고유해야 함)
// IAM 사용자 만들고 엑세스 키 생성하여 연결 (AmazonS3FullAccess 권한 줘야 함)
// https://artiiicy.tistory.com/16
const { S3Client, AbortMultipartUploadCommand, PutObjectCommand, GetObjectCommand } = require("@aws-sdk/client-s3");
const fs = require('fs')
const path = require('path');
require('dotenv').config()
const bucketName = "yubs87-testbucket"
const express = require('express')
@akaz00
akaz00 / MainActivity.kt
Last active November 15, 2021 08:46
FileWriter를 이용한 파일 작성 (안드로이드)
package com.example.test
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import java.io.*
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@akaz00
akaz00 / cache.js
Last active June 30, 2021 00:06
캐시 데코레이터
function flatObjToArray(o) {
return Object.keys(o).sort().reduce(function (r, k) {
if(typeof o[k] !== "object") return r.concat(k, o[k]);
else return r.concat(k, flatObjToArray(o[k]));
}, []);
}
// 전달되는 함수는 모두 결정적인 함수라고 가정
function cache(f, thisContext = null) {
const cached = new Map();
pragma solidity ^0.4.24;
import "./ERC20Interface.sol";
import "./SafeMath.sol";
contract MyToken is ERC20Interface { // 계약 선언
using SafeMath for uint;
string public constant name = "MyToken"; // 토큰명
string public constant symbol = "MTK"; // 토큰 기호
uint8 public constant decimals = 18; // 소수점 수
pragma solidity ^0.4.21;
contract Escrow{
uint public value;
address public seller;
address public buyer;
string public message;
enum State {Created, Locked, Sent, Complete}
State public state;
@akaz00
akaz00 / 0_reuse_code.js
Created August 22, 2017 16:21
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
#include "stdafx.h"
#include <iostream>
using namespace std;
int main()
{
// 사이즈 5이지만 4개만 저장되는 이유!? -> null terminator 저장 때문
// 따라서 저장할 문자가 n개면 사이즈는 n+1로 잡기
char *buf = new char[6];
cin.get(buf, 6);
@akaz00
akaz00 / OpenWithSublimeText2.bat
Created February 17, 2016 08:19 — forked from mrchief/LICENSE.md
Add "Open with Sublime Text 2" to Windows Explorer Context Menu (including folders)
@echo off
SET st2Path=C:\Program Files\Sublime Text 2\sublime_text.exe
rem add it for all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2" /t REG_SZ /v "" /d "Open with Sublime Text 2" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2" /t REG_EXPAND_SZ /v "Icon" /d "%st2Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2\command" /t REG_SZ /v "" /d "%st2Path% \"%%1\"" /f
rem add it for folders
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 2" /t REG_SZ /v "" /d "Open with Sublime Text 2" /f
@akaz00
akaz00 / gist:e4d3a3372faa3e7a7dfb
Created October 28, 2014 16:19
lookandsay seq
def mysplit(target):
tuples = []
prev = target[0]
count = 1
for idx, c in enumerate(target[:-1]):
if prev != target[idx+1]:
tuples.append((prev, count))
count = 1
else:
import ddf.minim.*;
import ddf.minim.analysis.*;
Minim minim;
AudioPlayer player;
AudioMetaData meta;
BeatDetect beat;
int r = 200;
float rad = 70;
void setup()