Skip to content

Instantly share code, notes, and snippets.

View hedcler's full-sized avatar

Hedcler Morais hedcler

View GitHub Profile
@hedcler
hedcler / local_proxy.pac
Last active September 1, 2017 19:54
*.local proxy pass with PAT file
function FindProxyForURL(url, host) {
if (shExpMatch(host, "*.local")) {
return "PROXY proxy.local";
}
return "DIRECT";
}
@hedcler
hedcler / daemon-template.sh
Created March 8, 2018 17:44
Linux daemon template
#!/bin/bash
SRC_PATH=/path/to
FILE_WO_EXT=filename
case "$1" in
start)
$SRC_PATH/$FILE_WO_EXT.sh &
echo $!>/var/run/$FILE_WO_EXT.pid
;;
@hedcler
hedcler / Python Threads
Created December 19, 2019 19:23
How threads works in Python
without join:
+---+---+------------------ main-thread
| |
| +........... child-thread(short)
+.................................. child-thread(long)
with join
+---+---+------------------***********+### main-thread
| | |
| +...........join() | child-thread(short)
# http://stackoverflow.com/questions/9548755/powerpoint-ppt-to-jpg-or-png-image-conversion-using-php#16045442
## Dependencies
apt-get install unoconv
apt-get install imagemagick
## First converts your presentation to PDF
unoconv -f pdf presentation.ppt
## Then convert your PDF to jpg
convert presentation.pdf presentation_%03d.jpg
@hedcler
hedcler / timezone.json
Last active April 17, 2020 17:49
JSON Timezones
[
{
"value": "Dateline Standard Time",
"abbr": "DST",
"offset": -12,
"isdst": false,
"text": "(UTC-12:00) International Date Line West",
"utcTimezone": [
"Etc/GMT+12"
]
@hedcler
hedcler / get_random_string.func.sql
Created April 22, 2020 19:31
Postgres create random string
CREATE OR REPLACE FUNCTION get_random_string(
IN string_length INTEGER,
IN possible_chars TEXT DEFAULT '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
) RETURNS text
LANGUAGE plpgsql
AS $$
DECLARE
output TEXT = '';
i INT4;
pos INT4;