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
--- localtime of sqlite MUST be the same with app that sent incorrect touched_date | |
with param as ( | |
select | |
touched_date as v, timediff(datetime(touched_date, 'localtime'), datetime(touched_date)) as delta from <errored-table-name>) | |
select | |
delta, | |
datetime(v), | |
CASE WHEN SUBSTR(delta, 1, 1) = '+' | |
THEN datetime(v, REPLACE(delta, '+', '-')) | |
ELSE datetime(v, REPLACE(delta, '-', '+')) |
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 | |
cd "$(dirname "$0")" | |
shopt -s nocaseglob | |
rm -frv ./optimized_images/* | |
mkdir -p ./optimized_images/400w | |
AWS_PATH="<s3-uri>" | |
for f in ./unoptimized_images/*.{jpg,jpeg,png} |
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
package main | |
import ( | |
"fmt" | |
"strings" | |
) | |
type stringsBuilder struct { | |
strings.Builder | |
kv map[string]string |
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
$lang = [ | |
'af' => 'afrikaans', | |
'hr' => 'croatian', | |
'pa' => 'punjabi', | |
'am' => 'amharic', | |
'ht' => 'haitian', | |
'pl' => 'polish', | |
'ar' => 'arabic', | |
'hu' => 'hungarian', | |
'ps' => 'pashto', |
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 | |
shopt -s extglob | |
# usage ./.partition <$1 path to directory taht contains image files to be converted to pdf> <$2 number of images converted in a lap> <$3 scale "x y" optional> > | |
# ./.partition path/to/directory 10 "0.9 0.9" | |
# dependencies: pdftk and cpdf | |
cd "$1" |
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
function scale($svg, $k) { | |
$rxvbox = '/viewBox="(\d+) (\d+) (\d+) (\d+)"/si'; | |
$rxw = '/width="(\d+)"/si'; | |
$rxh = '/height="(\d+)"/si'; | |
$rxx = '/x="(\d+)"/si'; | |
$rxy = '/y="(\d+)"/si'; | |
$svg = preg_replace_callback($rxvbox, function($m) use ($k) {return 'viewBox="'.$m[1]*$k.' '.$m[2]*$k.' '.$m[3]*$k.' '.$m[4]*$k.'"';}, $svg); | |
$svg = preg_replace_callback($rxw, function($m) use ($k) {return 'width="'.$m[1]*$k.'"';}, $svg); | |
$svg = preg_replace_callback($rxh, function($m) use ($k) {return 'height="'.$m[1]*$k.'"';}, $svg); | |
$svg = preg_replace_callback($rxx, function($m) use ($k) {return 'x="'.$m[1]*$k.'"';}, $svg); |
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 <input.image> -sampling-factor 4:2:0 -strip -quality 80 -interlace JPEG -colorspace sRGB -sigmoidal-contrast 5,50% <output.image> | |
convert <non.webp> -define webp:lossless=false <output.webp> |
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
find ./ -type f -regextype posix-extended -regex "\.\/(frontend|uploads)\/.+\.(jpe?g|png)" |
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></title> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
</head> | |
<body> |
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 | |
if [ -z $1 ]; then echo "introdu cale fisier"; exit 1; fi | |
covfile=${1%.*}.cov | |
# run this block in background | |
{ | |
gs -o - -sDEVICE=inkcov "$1" > "$covfile" | |
sed -i -E '/^\S/d' "$covfile" | |
awk '{c+=$1; m+=$2; y+=$3; k+=$4; next} END{c=c/NR; m=m/NR; y=y/NR; k=k/NR; print "C="c " M="m " Y="y " K="k " T="c+m+y+k}' "$covfile" |
NewerOlder