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 / find-replace-in-files-regex.py
Last active November 13, 2024 15:40
Find replace in files recursively with regular expressions
#!/usr/bin/env python3
#
# Example Usage:
# -------------------------------------------------------------------------------
# modify dates from 30-10-2024 to 2024-10-30
# find-replace-in-files-regex.py -g "*.html" "(\d\d)-(\d\d)-(\d\d\d\d)" "\3-\2-\1"
# -------------------------------------------------------------------------------
import argparse
@glowinthedark
glowinthedark / getlinks.py
Last active November 7, 2024 12:24
Extract links from a URL or a local file system path
@glowinthedark
glowinthedark / countryFlagsNamesAndDialCodes.json
Created November 5, 2024 18:33 — forked from angusjf/countryFlagsNamesAndDialCodes.json
Country Emoji Flags, Names and Dial Codes JSON Mapping
{
"ad": {
"flag": "🇦🇩",
"name": "Andorra",
"dialCode": "+376"
},
"ae": {
"flag": "🇦🇪",
"name": "United Arab Emirates",
"dialCode": "+971"
@glowinthedark
glowinthedark / multiple_ssh_setting.md
Created November 1, 2024 17:34 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "[email protected]"
@glowinthedark
glowinthedark / AndroidEmulator.js
Last active October 14, 2024 06:53
run android emulator on macos
#!/usr/bin/osascript -l JavaScript
// THE SHEBANG IS ONLY NEEDED IF YOU RUN IT AS A SHELL SCRIPT
// ^^^ REMOVE THE SHEBANG LINE ABOVE IF RUNNING FROM SCRIPT EDITOR/AUTOMATOR!!!!! ^^^
// 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 / aliexpress_order_history_export_csv.js
Last active September 23, 2024 12:28
AliExpress Order History export to CSV
function formatCSVValue(value) {
value = String(value);
// If the value contains a comma, newline, or quote, it needs to be quoted
if (/[,\"\n]/.test(value)) {
// Escape quotes by doubling them
value = value.replace(/"/g, '""');
// Wrap the value in quotes
value = `"${value}"`;
}
@glowinthedark
glowinthedark / yt-dlp-local-m3u8-playlist-download-bullk.sh
Last active September 24, 2024 16:19
yt-dlp download from local m3u8 playlist files
#!/usr/bin/env bash
find . -iname "*.m3u*" -exec yt-dlp --enable-file-urls file://$PWD/{} \;
# same as above with subshell
find * -iname '*.m3u*' -print -exec sh -c 'yt-dlp --enable-file-urls "file://$PWD/${1}"' _ {} \;
@glowinthedark
glowinthedark / macos_check_pytorch_metal_support.py
Created June 20, 2024 18:37
check if pytorch can use macos apple silicon chip metal support
#!/usr/bin/env python3
import torch
def is_metal_enabled():
"""Checks if Metal acceleration is enabled for PyTorch."""
# Check if MPS backend is available on the system
if not torch.backends.mps.is_available():
print("MPS backend is not available on this system.")
return False
package com.legbehindneck;
import java.io.IOException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.core.JsonPointer;
public class Main {
public static void main(String[] args) {