Skip to content

Instantly share code, notes, and snippets.

Avatar

Jeong-Hee Kang keizie

View GitHub Profile
@keizie
keizie / umpv.sh
Created Feb 15, 2020
bash clone of python umpv from mpv package
View umpv.sh
#!/bin/bash
FIFO="/tmp/mpvpipe"
TARGET=$1
if [ "x--" = "x$TARGET" ]; then
TARGET=$2
fi
PID=$(fuser $FIFO 2> /dev/null)
@keizie
keizie / navermap-reversegeocode.js
Last active Jun 8, 2018
네이버 맵이 너무 웹페이지 출력에 맞춰져서 URL 호출만으로는 사용할 수 없는 바람에 만들어본 샘플
View navermap-reversegeocode.js
'use strict';
const puppeteer = require('puppeteer');
(async() => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('적당한URL', { waitUntil: 'networkidle2' });
await page.addScriptTag({
// 대량으로 호출해야 한다면 파일로 저장하고 path 옵션으로 추가하는 방식도 가능해보임
@keizie
keizie / img2txt.js
Created Mar 27, 2016
OCR via Google Vision API
View img2txt.js
var fs = require('fs');
var request = require('request');
var base64 = require('base64-stream');
var JSONStream = require('JSONStream');
var visionArgs = {key: fs.readFileSync('vision.key')};
var visionUrl = 'https://vision.googleapis.com/v1/images:annotate';
var reader = process.stdin.pipe(base64.encode());
var writer = request.post({
@keizie
keizie / generator.php
Created Mar 26, 2016
Running multiple generator simultaneously
View generator.php
<?php
$epoch = microtime(true);
function times(int $a) {
global $epoch;
$i = 0;
while (++$i <= $a) {
//sleep(1);
var_dump(microtime(true) - $epoch);
@keizie
keizie / vfio-bind.sh
Created Jul 6, 2015
vfio-bind that does not hang on trying to bind again
View vfio-bind.sh
#!/bin/bash
modprobe vfio-pci
for dev in "$@"; do
if [ -e /sys/bus/pci/drivers/vfio-pci/$dev ]; then
continue
fi
vendor=$(cat /sys/bus/pci/devices/$dev/vendor)
device=$(cat /sys/bus/pci/devices/$dev/device)
View autounrar.py
#!/usr/bin/python3
import os, re, logging
from glob import glob
from pipes import quote
from shutil import rmtree
SOURCES = ('/mnt/1.5T/,movie/','/mnt/1.5T/,tv/',)
LOGFILE = '/home/keizie/.brag/autounrar.log'
EXECUTE_RAR = 'unrar'
@keizie
keizie / tease.py
Last active Dec 20, 2015
http://zariski.wordpress.com/2013/08/02/%EC%98%A4%EB%8A%98%EC%9D%98-%EB%B8%8C%EB%A0%88%EC%9D%B8%ED%8B%B0%EC%A0%80/ 문제를 확인하기 위한 코드. 결과적으로 35개의 3으로 이루어진 목록은 나오지만 최종적으로 1만으로 이루어진 데까지는 가지 않는다.
View tease.py
# -*- coding:utf-8 -*-
from itertools import combinations
from pprint import pprint
bundle = [51,49,5]
candidates = [bundle]
loop = True
loop_count = 0
largest_member = []
You can’t perform that action at this time.