Skip to content

Instantly share code, notes, and snippets.

@vzts
vzts / build_cross_gcc
Last active May 14, 2017 05:05 — forked from preshing/build_cross_gcc
A shell script to download packages for, configure, build and install a GCC cross-compiler.
#! /bin/bash
set -e
trap 'previous_command=$this_command; this_command=$BASH_COMMAND' DEBUG
trap 'echo FAILED COMMAND: $previous_command' EXIT
#-------------------------------------------------------------------------------------------
# This script will download packages for, configure, build and install a GCC cross-compiler.
# Customize the variables (INSTALL_PATH, TARGET, etc.) to your liking before running.
# If you get an error and need to resume the script from some point in the middle,
# just delete/comment the preceding lines before running it again.
@vzts
vzts / cordova-plugin-guide.md
Created February 20, 2018 06:28 — forked from mlynch/cordova-plugin-guide.md
Cordova Plugin Developer Guide

Cordova Plugin Development Guide (iOS and Android)

Version: 0.0.1 updated 7/1/2016

Cordova Plugins are the magic that enable our mobile web app content to access the full power of Native SDKs underneath, but through clean JavaScript APIs that work the same across all platforms we target.

Building Cordova plugins is scary for many Cordova and Ionic developers, but it doesn't have to be. This simple guide walks through the what, when, why, and how of Cordova plugin development for iOS and Android.

Introduction

@vzts
vzts / map.py
Created June 5, 2019 14:23
map.py
def read_map(file_name: str):
# read file
f = open(file_name, 'r')
content = f.read()
# save in two dim array
map = []
# separate by lines
lines = content.split('\n')
@vzts
vzts / test.py
Last active December 23, 2019 06:58
time.sleep gevent.sleep test
import threading
import time
import gevent
def hi1():
time.sleep(3) # release GIL
print('hi1')
@vzts
vzts / kr_won_to_backquote.sh
Created March 4, 2020 15:10 — forked from redism/kr_won_to_backquote.sh
macOS Sierra에서 원화(₩) 대신 백 쿼트(`) 입력하기
#!/bin/bash
if [ -f ~/Library/KeyBindings/DefaultkeyBinding.dict ]; then
echo "~/Library/KeyBindings/DefaultkeyBinding.dict already exists"
exit -1
fi
mkdir -p ~/Library/KeyBindings
cat << EOF > ~/Library/KeyBindings/DefaultkeyBinding.dict
{
"₩" = ("insertText:", "\`");
@vzts
vzts / interpolation.jsx
Last active November 14, 2022 20:55
How to convert native AnimatedInterpolation into js AnimatedInterpolation in React Native
const Component = ({ interpolationNative }) => {
const interpolationJs = useRef(new Animated.Value(0)).current
useEffect(() => {
const listener = interpolationNative.addListener(
Animated.event([{ value: interpolationJs }], { useNativeDriver: false }),
)
return () => interpolationNative.removeListener(listener)
}, [interpolationNative, interpolationJs])
// interpolate with interpolationJs
@vzts
vzts / avoid-in-app.js
Last active August 19, 2024 05:38
카카오톡 인앱 브라우저 탈출하기 코드 가장 심플하게 정리 (2023.10.27 동작 확인)
const userAgent = navigator.userAgent.toLowerCase()
if (/kakaotalk/.test(userAgent)) {
location.href =
'kakaotalk://web/openExternal?url=' + encodeURIComponent(location.href)
setTimeout(() => {
location.href = /ipad|iphone|ipod/.test(userAgent)
? 'kakaoweb://closeBrowser'
: 'kakaotalk://inappbrowser/close'
})