Skip to content

Instantly share code, notes, and snippets.

View kuzminT's full-sized avatar

Tim kuzminT

View GitHub Profile
@kuzminT
kuzminT / wp_sanitize_file_name.php
Created March 19, 2019 09:26 — forked from edirpedro/wp_sanitize_file_name.php
Translit file names to simple chars, this prevent WordPress to allow accents and special chars at file names that breaks in some server's configuration.
/*
* Translit file names to simple chars,
* this prevent accents and special chars at file names.
***********************************************************************/
function my_sanitize_file_name($filename) {
return remove_accents($filename);
}
add_filter('sanitize_file_name', 'my_sanitize_file_name');
/*
@kuzminT
kuzminT / pymysql_examples.py
Last active May 29, 2019 20:02
Examples for pymysql lib with python 3
""""
:link: https://github.com/PyMySQL/PyMySQL
"""""
import pymysql
import pymysql.cursors
connection = pymysql.connect(host="localhost",
user="root",
password="1234",
@kuzminT
kuzminT / postgresql-set-id-seq.sql
Created June 16, 2021 09:57 — forked from henriquemenezes/postgresql-set-id-seq.sql
PostgreSQL set Next ID Sequence Value to MAX(id) from Table
-- Get Max ID from table
SELECT MAX(id) FROM table;
-- Get Next ID from table
SELECT nextval('table_id_seq');
-- Set Next ID Value to MAX ID
SELECT setval('table_id_seq', (SELECT MAX(id) FROM table));