Skip to content

Instantly share code, notes, and snippets.

@kurohai
kurohai / spauth.py
Last active August 29, 2015 14:17 — forked from juntalis/spauth.py
import os
import requests
import re
from pprint import pprint
from htmlentitydefs import name2codepoint
from simplejson import loads
class spauth:
@kurohai
kurohai / supervisor-config-autossh.ini
Last active July 9, 2019 18:47 — forked from gtt116/gist:e7abe1c32a46df85b7599fbc7a9f9f73
autossh supervisord config file
[program:autossh]
command=autossh -M0 -N
-o "ExitOnForwardFailure yes"
-o "ServerAliveInterval 15"
-o "ServerAliveCountMax 4"
-o "ControlPath none"
-o "UserKnownHostsFile=/dev/null"
-o StrictHostKeyChecking=no
-R 1234:localhost:1234
-R 4567:localhost:4567
@kurohai
kurohai / htc_vive_virtual_keypress.py
Created January 1, 2019 18:57 — forked from notgne2/htc_vive_virtual_keypress.py
Small script to convert HTC Vive controller inputs into virtual keypresses for autohotkey (thanks to awesomebytes)
#!/usr/bin/env python
import time
import pprint
import openvr
import win32api
import win32con
"""
Convert HTC Vive inputs to virtual keypresses for autohotkey
@kurohai
kurohai / htc_vive_controller_keypresses.py
Created January 1, 2019 18:58 — forked from awesomebytes/htc_vive_controller_keypresses.py
Example on how to retrieve the HTC vive controller keypresses using pyopenvr
#!/usr/bin/env python
import time
import pprint
import openvr
"""
Get the HTC Vive controllers keypresses and print them to screen.
@kurohai
kurohai / GDI.ahk
Created January 1, 2019 19:00 — forked from G33kDude/GDI.ahk
GDI wrapper for AutoHotkey
class GDI
{
__New(hWnd, CliWidth=0, CliHeight=0)
{
if !(CliWidth && CliHeight)
{
VarSetCapacity(Rect, 16, 0)
DllCall("GetClientRect", "Ptr", hWnd, "Ptr", &Rect)
CliWidth := NumGet(Rect, 8, "Int")
CliHeight := NumGet(Rect, 12, "Int")
@kurohai
kurohai / search.py
Created February 6, 2019 13:31 — forked from lmyyao/search.py
 via search engine or baidu engine spider
from __future__ import print_function
from bs4 import BeautifulSoup as bs
import requests
import logging
from itertools import count
import time
from blinker import signal
from lxml.html.clean import Cleaner
from lxml.html import tostring, fromstring, iterlinks
from selenium import webdriver
  1. Download and pin books at https://read.amazon.com, and use epubor KCR converter to convert them into epubs.
  2. Download audio books at https://audible.com, with aax format.
  3. Obtain your activation bytes with the instruction of this post.
  4. Install ffmpeg with brew.
  5. Install audible-converter with npm. (File name will be extended automatically)
audible-converter "*.aax" -a <your-activation-bytes>
  1. Install atomicparsley with brew. (to add artwork to converted m4a files) Bash script to add artworks to m4a files:
@kurohai
kurohai / sync-it
Created August 4, 2020 14:43 — forked from playpauseandstop/sync-it
Additional wrapper to rsync command with profiles.
#!/usr/bin/env python
#
# Additional wrapper to ``rsync`` command with profiles.
#
# Requirements
# ============
#
# * Python_ 2.4 or higher
# * rsync_
#
#!/usr/bin/env python
"""
Uses rsync to sync files in parallel between a source and destination.
This script has been tested with Python 2.7.4 and 2.6.8; it requires 2.5+.
This script has also been tested with rsync versions 3.0.9 and 2.6.8.
BASIC USAGE:
@kurohai
kurohai / rsync_backup.py
Created August 4, 2020 14:46 — forked from RoguePixel/rsync_backup.py
rsync wrapper scripts
#!/usr/bin/python
import sys, os, subprocess
##
##RSYNC-BACKUP V1
#the script can be executed and by defualt the variables specified in the script will used, otherwise arguments may be passed to the script at runtime. This script can be used to sync remote files to a local directory or local files to a remote direcory specified at runtime.
##
##
#argument examples:
#":~$ rsync-backup.py -raz user@host:/some/dir/ /some/dir"