This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# by Simo / maqq | |
# tl;dr; don't use this but see https://github.com/ikappaki/basilisp-blender | |
import bpy | |
import uuid | |
import traceback | |
from basilisp import main as basilisp, cli | |
from basilisp.lang import compiler, runtime | |
from collections import OrderedDict | |
import socket |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Link the FR translation and the EN translation | |
* Called by API https://domain.com/wp-json/link_translation/post/ | |
*/ | |
function custom_rest_link_translation($data) { | |
//Source https://wpml.org/wpml-hook/wpml_set_element_language_details/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Connect to a dynamic NGROK endpoint that changes ofter after server restart etc. | |
# Works with single active tunnel (per account) on free tier. | |
# Provides persistent or dedicated endpoint like premium experience. | |
# Requires environment variable $NGROK_APIKEY | |
NGROK_ENDPOINT=$(curl -s https://api.ngrok.com/tunnels -H "authorization: Bearer $NGROK_APIKEY" -H "ngrok-version: 2" | jq -r '.tunnels[0].public_url') | |
NGROK_HOST=$(echo "$NGROK_ENDPOINT" | cut -d':' -f2 | cut -d'/' -f3) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pip install selene | |
from selene import browser, by, be | |
from time import sleep | |
browser.config.base_url = 'http://127.0.0.1:7860' | |
browser.config.driver_name = 'firefox' | |
browser.open('/') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This fan config helps to keep Thinkpad silent at work | |
# With it eg. 200$ second-hand 2-core Skylake laptop T460 and onwards can encode 1440p 30fps h264/h265 with | |
# Intel QuickSync HW encoder via proprietary VA-API driver https://wiki.debian.org/HardwareVideoAcceleration, | |
# silently, and stream it via OBS (RTMP/SRT/NDI..) etc.. | |
# To use this fan config on a single-fanned Thinkpad with Debian and systemd, run: | |
# sudo apt install thinkfan | |
# sudo echo "options thinkpad_acpi fan_control=1" > /etc/modprobe.d/thinkpad_acpi.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>A simple clock</title> | |
</head> | |
<body translate="no" > |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Convert srt file (from eg. pywhispercpp) into csv format with sub start location also in seconds to create Youtube time link. | |
# Could be useful for annotating livestream recordings from transcription in a spreadsheet. | |
# Deps (Python 3.11): | |
# pip install srt | |
import csv | |
import srt | |
def srt_to_csv(srt_file, youtube_link): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://code.jquery.com/jquery-3.6.0.js" integrity="sha256-H+K7U5CnXl1h5ywQfKtSj8PCmoN9aaq30gDh27Xc0jk=" crossorigin="anonymous"></script> | |
<div class="gh-starred-repos"></div> | |
<script> | |
var urlToGetLatestStarredRepos = "https://api.github.com/users/jasalt/starred?per_page=10"; | |
jQuery(document).ready(function () { | |
jQuery.getJSON(urlToGetLatestStarredRepos, function (allRepos) { | |
jQuery.each(allRepos, function (i, repo) { | |
var repoUrl = jQuery('<a style="color:red;"></a>').text(repo.full_name).attr('href', repo.html_url).appendTo(".gh-starred-repos"); | |
jQuery(".gh-starred-repos").append("<label> [" + repo.description + "]</label>" + " <i><strong>" + repo.language + "</strong> ⭐ " + repo.stargazers_count + " </i> "); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import glob | |
import os | |
import sys | |
def print_help(): | |
print(''' Replaces file shortcuts in given path with files they represent (on MacOS). | |
Directory shortcuts are skipped. Requires Python 3.10. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// html page has a list of possible suggested tags rendered (see php file) which have a button from which they can be added as post tag eg: | |
// <p class="demo_tag">New demo tag<button class="button demo_add_keyword_as_tag_btn " data-nonce="XXX" data-demo_keyword="New demo tag" data-post_id="XXX">+</button></p> | |
// Click handler for buttons and ajax call | |
jQuery('.demo_add_keyword_as_tag_btn').click(function(e) { | |
e.preventDefault(); | |
if (e.target.classList.contains("button-disabled")){ | |
return; | |
}; |
NewerOlder