Skip to content

Instantly share code, notes, and snippets.

@kdssoftware
kdssoftware / fixundefinedaudio.sh
Created February 27, 2024 09:11
set all undefined audio stream of mp4 movies to english
#!/bin/bash
function process_file() {
movie_file="$1"
echo "Checking $movie_file"
if ffprobe -v error -show_format -select_streams a:0 -show_streams "$movie_file" | grep "language=und"; then
echo "Movie audio undefined: updating $movie_fil ( do not CTRL+C )" # remove .bak file if exist
# Create a backup
backup_file="${movie_file}.bak"
echo "Creating backup $backup_file"
@kdssoftware
kdssoftware / gist:c6cc3b77210a91c271e66bd0f8e51c7c
Last active November 15, 2023 15:34
Download all .ipa and .apk files from artefact
#Download all .ipa and .apk files from artefact
wget 'http://artefacts.endpoint/path' -nH --cut-dirs=2 -r -np -nc -q -A ipa,apk -P './path/destination'
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import hashlib
import base58
def sha256(hexstr):
"""sha256 hash algorithm
"""
@kdssoftware
kdssoftware / searchExampleWithAjax.html
Created March 29, 2022 17:12
This example explains how to create search bar with ajax. Built for production
<html>
<head>
<!--
@author kdssoftware
@created at 3/29/2022
@contact kdssoftware.com
Beware: this will only work in practice if you have an api call `/api/search?search=value` set up
-->
@kdssoftware
kdssoftware / vbox.create.sh
Last active February 7, 2023 17:18
Auto create machine in vbox using a script.
#!/bin/bash
MACHINENAME=$1
# Starts a new machine with 20GB RAM and 150GB DISK
# basepath /mnt/kiko
# Download debian.iso
if [ ! -f ./debian.iso ]; then
wget https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-11.6.0-amd64-netinst.iso -O debian.iso
fi
sudo mkdir /mnt/kiko/$MACHINENAME
DROP TABLE IF EXISTS item, inventory_item, "order", order_tags, order_payment,
order_shipping, shipping_address, address_name, order_cost,
order_disp_cost, order_item, store, "user", order_has_order_item;
CREATE TABLE IF NOT EXISTS item (
"no" TEXT NULL,
"name" TEXT NULL,
"type" TEXT NULL,
category_id NUMERIC NULL,
fyrebrick_id SERIAL,
/**
* component last updated by Karel De Smet 27/08/2021
* ------------------------ (github.com/snakehead007)
*
* How to use:
* --
* add to an input element 1 or more checkers to its class and add a data- accordingly
* e.g. `<input id="some-text" class="form_checker-is_empty" data-is_empty="this message will be shown when its empty"/>`
*
* the error message will be shown where the id prefix is the same as the input id.
@kdssoftware
kdssoftware / autoRotate.js
Last active August 14, 2021 09:08
Jimp autorotate using Exif tags
let autoRotate = async (JimpImage) =>{
switch(JimpImage._exif.tags?.Orientation||1){
case 2:
await JimpImage.flip(true,false);
break;
case 3:
await JimpImage.rotate(180);
break;
case 4:
await JimpImage.rotate(180).flip(true,false);
@kdssoftware
kdssoftware / env-loader.php
Created July 2, 2021 07:37
loads .env file into $_ENV
<?php
class env
{
//usage:
//env::$load() // loads .env file
//env::$load("dev") //loads dev.env file
//CAUTION! : at an empty line after the last variable entry. see example below
public static function load ($prefix="") {
$file = file($_SERVER['DOCUMENT_ROOT'].'/ici/'.$prefix.'.env');
foreach ($file as $line_num => $line) {
use admin
db.createUser(
{
user: "root",
pwd: "root",
roles:["root"]
}
);
use demo