Skip to content

Instantly share code, notes, and snippets.

View hans00's full-sized avatar
🤔
Thinking

Hans hans00

🤔
Thinking
View GitHub Profile
@hans00
hans00 / cursor
Last active March 2, 2025 13:23
Cursor cli command for Linux
#!/bin/bash
_APP=$(ls -1 ~/Applications/cursor*.AppImage)
_ARGS=()
for arg in "$@"; do
if [ -f "$arg" ] || [ -d "$arg" ]; then
_ARGS+=($(realpath "$arg"))
else
_ARGS+=("$arg")
@hans00
hans00 / cast.sh
Created February 20, 2021 04:16
Mac ChromeCast system audio
#!/bin/bash
# Output "BlackHole 16ch" and Input "BlackHole 16ch"
go-chromecast transcode --command 'rec -c 1 -r 16000 -t flac -' --content-type audio/flac --first
@hans00
hans00 / import-template.sh
Last active December 1, 2019 02:22
A script to import KVM(QEMU) template from disk image.
#!/bin/bash
SCRIPT=$0
MEMORY=2048
NET_DRV=virtio
NET_BRIDGE=vmbr0
STORAGE=local-lvm
SCSI_DRV=virtio-scsi-pci
IDE=0
@hans00
hans00 / anime4k-plugin.user.js
Last active February 4, 2023 10:37
Anime4K for VideoJS
// ==UserScript==
// @name Anime4K for VideoJS
// @match *://*/*
// @require https://raw.githubusercontent.com/bloc97/Anime4K/legacy/web/main.js
// @grant GM_addStyle
// @grant GM.listValues
// ==/UserScript==
//- The @grant directives are needed to restore the proper sandbox.
function Anime4K(options) {
@hans00
hans00 / conv_vbox2esxi_ova.py
Created March 10, 2019 15:24
Covert VirtualBox OVA to ESXi OVA
#!/usr/bin/env python3
import sys
import tarfile
import os
import hashlib
import tempfile
if len(sys.argv) != 2:
print('Usage: %s <OVA File>' % sys.argv[0])
#!/bin/bash
set -e
BASE_IMAGE="rancher/rancher:latest"
REGISTRY="registry.hub.docker.com"
IMAGE="$REGISTRY/$BASE_IMAGE"
CID=$(docker ps | grep $IMAGE | awk '{print $1}')
docker pull $IMAGE
for im in $CID
do
@hans00
hans00 / Dockerfile
Created April 10, 2018 03:34
nativescript-vue-android-docker
FROM frolvlad/alpine-oraclejdk8:full
# Android SDK
ENV ANDROID_HOME /opt/android-sdk-linux
ENV SDK_TOOLS_VERSION 3859397
ENV API_LEVELS android-25
ENV BUILD_TOOLS_VERSIONS 25.0.2
@hans00
hans00 / status.php
Last active October 15, 2017 13:20
Listen HTTP Status
<?php
// timeout (ms)
define('TIMEOUT', 500);
// sites ( 'ID' => [ 'name' => 'Display Name', 'url' => 'URL to check' ] )
define('SITE', [
'GOOGLE' => [
'name' => 'Google Inc.',
'url' => 'http://googl.com'
]
]);
@hans00
hans00 / batch_aria2c.sh
Last active October 28, 2018 14:49
wget 單線程太慢?來用 aria2c 吧
#!/bin/bash
PARENT_URL="$1"
urldecode(){
echo -e "$(sed 's/+/ /g;s/%\(..\)/\\x\1/g;')"
}
if [[ ! $PARENT_URL =~ ^.*\/$ ]]; then
PARENT_URL="$PARENT_URL/"
// 優化效率
#define ddtick __asm__("nop\n\t")
#if F_CPU == 20000000L
#define dd5tick __asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t")
#define delayOneUs() { dd5tick; dd5tick; dd5tick; dd5tick; }
#endif
#if F_CPU == 16000000L
#define dd4tick __asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t")
#define delayOneUs() { dd4tick; dd4tick; dd4tick; dd4tick; }
#endif