Skip to content

Instantly share code, notes, and snippets.

View stania's full-sized avatar

Albert Hwang stania

View GitHub Profile
@stania
stania / alias-aws.sh
Last active May 29, 2020 07:43
'aws' alias for AWS CLI v2 docker image considering running as non-root user
# usage : `. ./alias-aws.sh`
CONTAINER_HOME=/
if [[ "x$(id -u)" == "x0" ]]; then
CONTAINER_HOME=/root
fi
function awscli() {
docker run --rm -it -v ~/.aws:$CONTAINER_HOME/.aws -v $(pwd):/aws -u $(id -u):$(id -g) amazon/aws-cli $@
}
!v::
SetTitleMatchMode,2
DetectHiddenWindows, Off
if WinExist("ahk_class POEWindowClass")
{
WinActivate
Send, {Enter}
Send, ^v
Send, {Enter}
}
import org.araqne.api.*;
import org.araqne.ansicode.*;
class StringScriptInputStream implements ScriptInputStream {
def scanner;
StringScriptInputStream(String str) {
scanner = new Scanner(new StringReader(str));
}
@stania
stania / mvn
Last active May 14, 2018 16:45
mvn script for WSL
#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
@stania
stania / gist:d3749d031301bdf48b11
Last active August 29, 2015 14:17
Thread pause/resume technique
package sandbox;
import java.util.Date;
import java.util.concurrent.Phaser;
import java.util.concurrent.atomic.AtomicBoolean;
public class PhaserTest implements Runnable {
private static AtomicBoolean paused = new AtomicBoolean(false);
private static Phaser p = new Phaser(1);
@stania
stania / gist:99d6a416baa509d07aeb
Created November 13, 2014 09:03
wait for ip released from others in same network
@echo off
:chk
call ipconfl.bat %1
if errorlevel 1 goto exit
timeout /t 1 > nul
goto chk
exit /b 1
:exit
@stania
stania / gist:3e03d1c1b29c94f3afbc
Created November 13, 2014 09:02
check if specified ip conflicts with others in same network
@echo off
setlocal
set IP=%1
arp -d %IP%
ping -4 -w 100 -n 1 %IP% > NUL
arp -a %IP% | findstr %IP% > NUL
exit /b %ERRORLEVEL%
@stania
stania / bitly.py
Created September 14, 2013 18:24
bitly commandline shortener
# -*- coding: utf-8 -*-
import traceback, sys
import bitly_api
from Tkinter import Tk
import tkMessageBox
access_token = ''
r = Tk()
@stania
stania / Perseids.txt
Last active December 20, 2015 23:29
Perseids
int main() {
/* *
. . * 0
0 . * .
. / *
. / *
. / . . .
/
. * / . *
/ *
package org.logpresso.misc;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
public class SignatureTesterMain {