Skip to content

Instantly share code, notes, and snippets.

View composite's full-sized avatar
🤡
This is the face. 이것은 면상이다.

Ukjin Yang composite

🤡
This is the face. 이것은 면상이다.
View GitHub Profile
@composite
composite / table2class.sql
Created July 5, 2018 06:35
Java object generator for Oracle
WITH TABLE_NM AS
( SELECT UPPER(:TARGET) as TABLE_NM
, '// ' as comm01
, '/**' as jdoc01
, ' * ' as jdoc02
, ' */' as jdoc03
, '' as prefix
, 'Vo' as surfix
FROM DUAL)
SELECT JAVA_CLASS
@composite
composite / StickyNotesBackup.en.ps1
Created July 27, 2018 06:58
A Powershell script that backup or restore Sticky Notes for Windows 10 Version 1607 (Anniversary Update) or later.
Add-Type -AssemblyName System.Windows.Forms
try {
Get-Variable PSScriptRoot -Scope Global -ErrorAction 'Stop' | Out-Null
} catch [System.Management.Automation.ItemNotFoundException] {
$PSScriptRoot = Split-Path -Parent -Path $MyInvocation.MyCommand.Definition
}
Function Get-FileName([System.String]$title)
{
$openFileDialog = New-Object Windows.Forms.OpenFileDialog
@composite
composite / move_older_than_a_month_ago.sh
Created September 14, 2018 02:21
Backup files that file is older than a month ago.
#!/bin/sh
SOURCE='/path/to/source'
DEST='/path/to/backup'
TARGET="$DEST/$(date +'%G%m')"
mkdir -p "$TARGET"
function copyext() {
@composite
composite / post.sh
Last active August 8, 2019 05:28
file content as post parameter value example (split by backslash for getting multiple request)
#!/bin/bash
function post() {
mkdir -p "$HOME/tmp/"
local a="$HOME/tmp/Q_$(openssl rand -hex 16).req"
echo > "$a"
vi "$a"
local b=""
local c=""
local t=""
@composite
composite / find.sh
Created October 18, 2018 02:07
File files utility on UNIX
#!/bin/sh
#GREP for gz
find /path/to/folder -name '*.log.gz' -print0 | xargs -0 zgrep "STRING"
#GREP for log
find /path/to/folder -name '*.log' -print0 | xargs -0 grep "STRING"
#GREP regex
tail -f /path/to/something.log | egrep "Exception|\[WARN|\[ERROR"
#find files with file name pattern and content and print all matched file content.
find /path/to/folder -name '*.txt' -print0 | xargs -0 grep "STRING" -l | xargs cat && echo
@composite
composite / intellij-patch.bat
Last active September 11, 2019 01:32
Intellij patch update when fails in IDE. (for 2018.2 and above. windows only.) place in your jetbrains IDE directory, and run it.
@ECHO OFF
SETLOCAL
REM Keep it if you placed this batch file in IDEA base directory.
SET BASEDIR=%~dp0
REM Keep it if you are using default installation. but don't forget to check your config folder named by Jetbrains IDE.
SET PATCH=%userprofile%\.IntelliJIdea\data\system\tmp\patch-update\
REM If you are using portable installation with portapps.io, comment above by prepend REM, and uncomment below by remove REM
REM SET PATCH=%BASEDIR%..\data\system\tmp\patch-update\
import java.io.IOException;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Timer;
import java.util.TimerTask;
@composite
composite / cmd_for_args.sh
Last active October 1, 2019 02:25
A shell file for custom command of generated path.
declare TARGET_PATH=/path/to/some.thing
if [ ! -z "$*" ]; then
if [[ "$*" == '-'* ]]; then
echo $TARGET_PATH
exit
fi
declare CMD="$1"
shift
declare ARG="$*"
@composite
composite / csv2sql.ps1
Last active December 11, 2019 02:26
Generate INSERT statements from CSV files in script path. not supported flexble options yet. use at your own risk. (for Powershell and node.js)
try {
Get-Variable PSScriptRoot -Scope Global -ErrorAction 'Stop' | Out-Null
} catch [System.Management.Automation.ItemNotFoundException] {
$PSScriptRoot = Split-Path -Parent -Path $MyInvocation.MyCommand.Definition
}
$commitsize = 1000
Get-ChildItem $PSScriptRoot -Filter *.txt | ForEach-Object {
"Processing: $($_.FullName)"