Skip to content

Instantly share code, notes, and snippets.

View glowinthedark's full-sized avatar

glowinthedark glowinthedark

  • URLError: <urlopen error [Errno 8] nodename nor servname provided, or not known>
  • HTTPError: HTTP Error 403: Forbidden
View GitHub Profile
@glowinthedark
glowinthedark / vimeo-download.py
Last active November 26, 2023 21:38 — forked from alexeygrigorev/vimeo-download.py
Downloading segmented video from vimeo
#!/usr/bin/env python3
import subprocess
import sys
from pathlib import Path
import requests
import base64
from tqdm import tqdm
@glowinthedark
glowinthedark / dict2mdx.sh
Last active November 18, 2023 14:18
Convert Lingvo DSL, Babylon BGL, Stardict, ZIM, etc dictionaries to MDict MDX (see formats supported by https://github.com/ilius/pyglossary)
#!/bin/bash
# Convert Lingvo DSL, Babylon BGL, Stardict, ZIM, etc dictionaries to MDict MDX (see input formats supported by https://github.com/ilius/pyglossary)
#
# Dependencies:
# python3, sqlite3, pyglossary, mdict-utils
# optional dependency: dictzip (for unpacking .dz files)
#
# Install all dependencies with:
# pip3 install pyglossary mdict-utils lxml polib PyYAML beautifulsoup4 html5lib PyICU libzim>=1.0 python-lzo prompt_toolkit
@glowinthedark
glowinthedark / NSAuthorization.h
Created October 8, 2023 12:06 — forked from TomLiu/NSAuthorization.h
Ask for privilege to execute command
//
// NSAuthorization.h
// OSXvnc
//
// Created by Jonathan Gillaspie on Fri Dec 12 2003.
// Copyright (c) 2003 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@glowinthedark
glowinthedark / scp-turbo.sh
Last active February 9, 2024 20:32
Copy folders between local <=> SSH remote using tar piped over SSH using scp syntax like: `scp-turbo.sh myremote:/etc/apache2 /tmp/mylocal/dir`
#!/usr/bin/env bash
# URL: https://gist.github.com/glowinthedark/e56fed33be889cea6ec2326dc33f535d
# uses scp syntax e.g.:
#
# REMOTE -> LOCAL (folder to folder)
# scp-turbo.sh myremote:/etc/apache2 /tmp/mylocal/dir
# REMOTE -> LOCAL (folder to .gz)
@glowinthedark
glowinthedark / ttc2ttf.sh
Last active August 15, 2023 11:10
TTC (True Type Font Collection) to TTF Extraction bash script
#!/usr/bin/env bash
# depends on:
# pip3 install fonttools
font="${1}"
for n in {1..10} ; do
echo $n
pyftsubset "${font}" --font-number=${n} \
package my.example.compat;
/*
* NOTICE: modified since 2023 and later.
*
* Copyright (C) 2008 The Android Open Source Project
*
* Licensed 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
@glowinthedark
glowinthedark / SimpTradDetect.java
Last active August 9, 2023 19:09
Chinese Simplified/Traditional characters detection
import java.util.regex.Pattern;
public class SimpTradDetect {
// data from https://github.com/tsroten/zhon/tree/main/src/zhon/cedict
// with shared characters between simplified and traditional removed
static final String TRAD = "㠯㵎㼝䠶䰾䳘丟並亂亙亞亾佀佇佈佔併來侖侶侷俁係俠俲俻倀倆倉個們倖倫偉偪側偵偽傌傑傖傘備傚傭傯傳傴債傷傾僂僅僉僑僕僞僥僨僱價儀儂億儈儉儐儔儕儗儘償優儲儷儸儺儻儼兇兌兒兗內兩冊冪凈凍凜凱別刦刧刪刼剄則剉剋剎剛剝剮剴創剷劃劄劇劉劊劌劍劑効勁動務勛勝勞勢勣勦勱勲勳勵勸勻匭匯匱區協卹卻厙厠厭厲厴參叢吳吶呂咷咼員哶唄唚問啞啟啣喚喪喫喬單喲嗆嗇嗎嗚嗩嗶嘆嘊嘍嘓嘔嘖嘗嘜嘩嘮嘯嘰嘵嘷嘸嘽噁噓噝噠噥噦噯噲噴噸噹嚀嚇嚌嚐嚕嚙嚥嚦嚨嚲嚳嚴嚶囀囁囂囅囈囉囌囑囪圇國圍園圓圖團埡執堅堊堖堝堯報場塊塋塏塒塗塚塢塤塲塵塹墊墜墮墳墻墾壇壓壘壙壚壞壟壠壢壩壯壺壼壽夠夢夾奐奧奩奪奮奼妝姍姦姪娛婁婦婭媧媯媼媽嫋嫗嫵嫻嬀嬈嬋嬌嬙嬝嬡嬤嬪嬰嬸孃孌孫學孿宂宮寢實寧審寫寬寳寵寶將專尋對導尒尷屆屍屓屜屢層屨屬屭岡峩峯峴島峽崍崐崑崗崙崢崬嵐嵗嶁嶃嶄嶇嶔嶗嶠嶧嶴嶸嶺嶼嶽巋巒巔巖巹帥師帬帳帶幀幃幇幗幘幚幟幣幫幬幹幾庫廁廂廄廈廕廚廝廟廠廡廢廣廩廬廳廹弒弔弳張強彆彈彊彌彎彙彞彠彥彫彿後徑從徠復徹怳恆恥悅悳悵悶悽惡惥惪惱惲惷惻愙愛愜愨愴愷愾慂慄態慍慘慚慟慣慪慫慮慳慶慼慾憂憊憐憑憒憚憤憫憮憲憶懇應懌懍懟懣懨懲懶懷懸懺懼懾戀戇戔戞戧戩戰戲戶戼抝拋挾捨捫捲掃掄掙掛採揀揚換揮揹損搖搗搯搵搶摑摜摟摯摳摶摻撈撏撐撓撝撟撣撥撧撫撲撳撻撾撿擁擄擇擊擋擔據擠擬擯擰擱擲擴擷擺擻擼擾攄攆攏攔攖攙攛攜攝攢攣攤攪攬敍敗敘敱敵數斂斃斕斬斷旂旹昰時晉晝暈暉暘暢暫暱曄曆曇曉曖曠曡曨曬書會朧朶東柵栢桮桿梔梘條梟棄棖棗棟棧棲椀椏楄楊楓楨業楳極榪榮榿構槍槓槤槧槨槮槳樁樂樅樓標樞樣樸樹樺橈橋機橢橫檁檉檔檜檟檢檣檮檯檳檸檻櫂櫃櫓櫚櫛櫝櫞櫟櫥櫧櫨櫪櫫櫬櫱櫳櫸櫺櫻欄權欏欒欖欞欽歎歐歟歡歲歷歸歿殀殘殞殤殫殭殮殯殲殺殼殽毀毆毿氂氈氌氣氫氬氳氷決沒沖況洶浹涇涖涼淒淚淥淨淪淵淶淺渙減渦測渾湊湞湧湯湼溈準溝溫滄滅滌滎滙滬滯滲滷滸滻滾滿漁漚漢漣漬漲漵漸漿潁潑潔潛潤潯潰潷潿澀澆
@glowinthedark
glowinthedark / applescript-detect-language-objc-bridge.applescript
Last active April 28, 2023 09:08
MacOS Applescript to detect language of text string and say it using TTS Voice for detected language
use framework "Foundation"
use framework "NaturalLanguage"
use framework "AVFoundation"
-- https://www.macscripter.net/t/detect-language-from-sentence-for-speech-synthesizer/74560
(**
* import Foundation
* import NaturalLanguage
* import AVFoundation
@glowinthedark
glowinthedark / macos-tts-say-notification-text.applescript
Last active May 23, 2023 08:56
Read aloud MacOS notifications using TTS voice synthesis
set previousList to {}
repeat
set currentList to {}
tell application "System Events"
tell process "Notification Center"
set allWindows to every window
set numWindows to count of allWindows
repeat with currentWindow in allWindows
try