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 / RsyncBackup.js
Last active December 4, 2023 15:32
MacOS RsyncBackup — simplest possible rsync GUI for MacOS
View RsyncBackup.js
#!/usr/bin/osascript -l JavaScript
// ^^^^ COMMENT/REMOVE THIS SHEBANG IF RUNNING FROM SCRIPT EDITOR!!!!! ^^^^^^^^^^^
// The SHEBANG is only needed if the file is executable and is run from a terminal with `./RsyncBackup.js`
// 1. In MacOS Spotlight type 'Script Editor' and paste the code below
// 2. Click the top-left dropdown which says 'AppleScript' and select 'JavaScript'
// 3. Under menu File pick Export
// 4. In the Export dialog select File Format = Application
// 5. Save the app in /Applications
@glowinthedark
glowinthedark / midnight-commander-build-macos.sh
Last active November 29, 2023 15:36
Midnight Commander: build and install from source on macos
View midnight-commander-build-macos.sh
brew install libssh libssh2 slang
clone --depth 1 https://github.com/MidnightCommander/mc.git
cd mc
./configure --disable-doxygen-doc --disable-doxygen-dot --disable-doxygen-html CPPFLAGS="-I/opt/homebrew/Cellar/libssh2/1.11.0_1/include -I/opt/homebrew/Cellar/s-lang/2.3.3/include -I/opt/X11/include" LDFLAGS="-L/opt/homebrew/Cellar/libssh2/1.11.0_1/lib -L/opt/homebrew/Cellar/s-lang/2.3.3/lib -L/opt/X11/lib"
make CPPFLAGS="-I/opt/homebrew/Cellar/libssh2/1.11.0_1/include -I/opt/homebrew/Cellar/s-lang/2.3.3/include -I/opt/X11/include" LDFLAGS="-L/opt/homebrew/Cellar/libssh2/1.11.0_1/lib -L/opt/homebrew/Cellar/s-lang/2.3.3/lib -L/opt/X11/lib"
sudo mkdir -p /usr/local/{libexec,etc,share}
sudo chown `whoami` /usr/local/{libexec,etc,share}
@glowinthedark
glowinthedark / vimeo-download.py
Last active November 26, 2023 21:38 — forked from alexeygrigorev/vimeo-download.py
Downloading segmented video from vimeo
View vimeo-download.py
#!/usr/bin/env python3
import subprocess
import sys
from pathlib import Path
import requests
import base64
from tqdm import tqdm
@glowinthedark
glowinthedark / generate_directory_index_caddystyle.py
Last active November 22, 2023 07:36
Generate directory index (recurse subfolders with `-r` or `--recursive`). Use `-h` or `--help` for all options
View generate_directory_index_caddystyle.py
#!/usr/bin/env python3
# NOTE: this script is deprecated;
# maintained version with SVG icons: https://github.com/glowinthedark/index-html-generator/
# ---
# Copyright 2020 glowinthedark
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@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)
View dict2mdx.sh
#!/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
View NSAuthorization.h
//
// 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-ssh-tar.sh
Last active September 5, 2023 18:44
Copy folders between local <=> SSH remote using tar piped over SSH using scp syntax like: `scp-turbo.sh myremote:/etc/apache2 /tmp/mylocal/dir`
View scp-turbo-ssh-tar.sh
#!/usr/bin/env bash
# uses scp syntax e.g.:
# REMOTE -> LOCAL
# scp-turbo.sh myremote:/etc/apache2 /tmp/mylocal/dir
#
# LOCAL -> REMOTE
# scp-turbo.sh /tmp/mylocal/dir myremote:/home/user32/
# see: >>>> https://www.cyberciti.biz/faq/howto-use-tar-command-through-network-over-ssh-session/
@glowinthedark
glowinthedark / ttc2ttf.sh
Last active August 15, 2023 11:10
TTC (True Type Font Collection) to TTF Extraction bash script
View ttc2ttf.sh
#!/usr/bin/env bash
# depends on:
# pip3 install fonttools
font="${1}"
for n in {1..10} ; do
echo $n
pyftsubset "${font}" --font-number=${n} \
View AsyncTask.java
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