Skip to content

Instantly share code, notes, and snippets.

View Tyxz's full-sized avatar

Arne Rantzen Tyxz

View GitHub Profile
@Tyxz
Tyxz / foolinglime.ipynb
Created July 7, 2020 13:39
FoolingLime.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
We couldn’t find that file to show.
@Tyxz
Tyxz / weekday.lua
Last active February 16, 2020 14:06
Calculate the week day in pure Lua. Only depends on the math package to floor numbers.
--[[----------------------------------------
Project: LibClockTST
Author: Arne Rantzen (Tyx)
Created: 2020-02-16
License: GPL-3.0
----------------------------------------]]--
--- Get the day of the week by the guassian algorithm
--@param table should be containing three ints: year, month, day
--@return weekday number after ISO norm from 1 = Monday to 7 = Sunday
@Tyxz
Tyxz / decrypt.sh
Last active February 6, 2020 20:54
Decrpyt all pdf in folder and its sub dirs. Use it with: decrpyt.sh [password] [[_safe] [_safe]] or just decrpyt.sh [password]. [_safe] is if you secured pdf looks like: blub_safe.pdf.
#!/bin/bash
for file in ./**/*$2.pdf; do
qpdf --decrypt --password=$1 "$file" "${file/$3.pdf/.pdf}";
done
@Tyxz
Tyxz / polylang-sync-rate-my-post.php
Last active August 18, 2022 17:28
Sync the ratings of the Wordpress plugin "rate-my-post" with all polylang translated variants of it.
<?php
if ( ! defined( 'ABSPATH' ) ) {
die;
}
function pll_sync_store_rating($post_id, $translation_id, $new_avg_rating, $new_vote_count, $submitted_rating) {
// Update rating sum
$new_ratings_sum = $submitted_rating;
if ( $new_vote_count > 1) {
$new_ratings_sum = get_post_meta($post_id, 'rmp_rating_val_sum', true);
@Tyxz
Tyxz / fast_delete.bat
Created December 21, 2019 13:24
Windows bat-script to fast delete a folder and all sub-directories with a cmd command.
@ECHO OFF
CLS
ECHO ######################################
ECHO # Fast delete folder and sub-folders #
ECHO ######################################
ECHO.
ECHO.
set /P c=Delete %CD% [Y/N]?
if /I "%c%" EQU "Y" goto :DELETE
if /I "%c%" EQU "J" goto :DELETE