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
console.log = | |
console.clear = | |
console.profile = | |
console.profileEnd = | |
eval = function(){}; |
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 | |
/** | |
* Check whether string $str can be interpreted as a valid UTF-8. | |
* | |
* @param (string) $str A string to check for UTF-8 | |
* @param (bool) $hasNonASCII_UTF8 If true, get non-ASCII bytes count in $str. | |
* | |
* @return (bool|int) if $str is not a valid UTF-8 string -> false | |
* if $str is a valid UTF-8 string, | |
* when $hasNonASCII_UTF8 == false -> true, |
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 | |
## | |
# 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 | |
## |
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
/** | |
* Parse URLs in a Browser environment. | |
* | |
* Ussage: | |
* 1) var hostname = $url('https://duzun.me/playground', 'hostname'); | |
* | |
* 2) var a = $url('https://duzun.me/playground?some=param'); | |
* a.protocol = 'http:'; | |
* var hrefSecured = a.href; | |
*/ |
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
/// Nice count to number (by DUzun) | |
;(function (global, FUNCTION, Number) { | |
var $ = global.jQuery || global.Zepto; | |
$.fn.counto = function fcounto(nr,dl,done) { | |
if(!dl) dl = 400; | |
var start = $.now(), | |
end = start + dl, | |
delay = 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
#!/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_= |
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
#!/bin/node | |
/*jshint esversion: 9*/ | |
/** | |
* Time-shift video subtitles in a .srt file. | |
* | |
* Usage: | |
* shiftsrt.js seconds input_file|- [output_file|-] | |
* | |
* Examples: |
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
#!/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 )) |
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
#!/bin/bash | |
fix_lib_links() { | |
local i j dir write | |
[ "$2" = "-w" ] && write="$2" | |
dir=${1:-$PWD} | |
( | |
cd "$dir" && \ | |
for i in *.so.*; do | |
if [ -f "$i" ]; then |
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
#!/bin/sh | |
# https://gist.github.com/duzun/234bd3ca69b243bb32bb | |
basedir=`dirname "$0"` | |
optimagurl=https://duzun.me/optimag.js | |
optimagjs=$basedir/optimag.js | |
case `uname` in | |
*CYGWIN*) optimagjs=`cygpath -w "$optimagjs"`;; |