Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Dumitru Uzun duzun

🎯
Focusing
View GitHub Profile
View hide_container_volumes_in_user-places.xbel.js
#!/usr/bin/env node
/*jshint node: true, esversion: 10 */
/**
* Hide container filesystems in ~/.local/share/user-places.xbel
*
* @url https://gist.github.com/duzun/e583e1634ed6f6765dbaba0ac846e5cc
* @author Dumitru Uzun
* @version 0.0.1
*/
@duzun
duzun / mysqli__multi_query.php
Last active Apr 1, 2020
Run Multi Query using mysqli in PHP
View mysqli__multi_query.php
if ($mysqli->multi_query("START TRANSACTION;$query--\nCOMMIT;")) {
$idx = 0;
$ret = 0;
if($output = $mysqli->error) {
echo $output, PHP_EOL;
die(-4);
}
else {
do {
@duzun
duzun / undetect-console.js
Created Mar 20, 2020
Try to make console undetectable (and broken)
View undetect-console.js
console.log =
console.clear =
console.profile =
console.profileEnd =
eval = function(){};
@duzun
duzun / casign
Created Feb 24, 2020
Create a SSL certificate signed by your CA root certificate.
View casign
#!/usr/bin/env bash
##
# Sign a certificate using my root_ca.
#
# Note: duzun_root_ca.crt must be in the trusted root ca (see https://www.archlinux.org/news/ca-certificates-update/)
#
# @author Dumitru Uzun (DUzun.Me)
# @version 1.1.0
##
@duzun
duzun / shiftsrt.js
Last active Feb 7, 2020
Shift time in .srt subtitles file
View shiftsrt.js
#!/bin/node
/*jshint esversion: 9*/
/**
* Time-shift video subtitles in a .srt file.
*
* Usage:
* shiftsrt.js seconds input_file|- [output_file|-]
*
* Examples:
@duzun
duzun / downlist
Last active Feb 7, 2020
Download media files from a m3u8 URL
View downlist
#!/bin/bash
# Download a file listed in a list file
# @author Dumitru Uzun (DUzun.Me)
# @version 1.0.1
_me_="$(basename "$0")"
_start_time_=$(date +%s)
referer=
_cat_=
@duzun
duzun / php_sess_to_redis.sh
Last active Jul 4, 2019
Bash script to import PHP session files into redis
View php_sess_to_redis.sh
#!/bin/bash
export REDISCLI_AUTH=my-supper-strong-password-4-redis-server
TTL=$(( 24 * 3600 ))
# cd "/var/sess"
for i in sess_*; do
ex=$(( $(date +%s) - $(stat -c %Y "$i") + $TTL ))
@duzun
duzun / fix_lib_links.sh
Created Dec 25, 2018
Fix /usr/lib/lib*.so links, in the case you `cp`ed lib folder from a backup (use `rsync -a`, not `cp`!)
View fix_lib_links.sh
@duzun
duzun / cron_eye_safe.sh
Last active Aug 6, 2018
Install notifications every 20 min and 2 hours to rest your eyes - KDE on Linux
View cron_eye_safe.sh
#!/bin/sh
#
# Keep your eyes safe on cron
#
# @author Dumitru Uzun (DUzun.Me)
# @web https://gist.github.com/duzun/99bd0d1cba6c8ad1b5bf321c2689a257
#
_user=${USER:-$(whoami)}
@duzun
duzun / findByKey.php
Last active Feb 7, 2018
Find a value in an array by key recursively
View findByKey.php
<?php
// Note:
// Whether $list contains a NULL value for $needle at some level, or there is no $needle at all,
// in both cases this function returns NULL.
// If you want to find non-NULL $needle only, replace `array_key_exists` with `isset`
function findByKey($list, $needle) {
$stack = [$list];
while( !empty($stack) ) {
You can’t perform that action at this time.