Skip to content

Instantly share code, notes, and snippets.

View wipermail's full-sized avatar
🎯
Focusing

wipermail

🎯
Focusing
View GitHub Profile
@wipermail
wipermail / show linux size files
Last active November 5, 2019 11:49
show linux size files
du -hsx * | sort -rh | head -10
@wipermail
wipermail / ubuntu label template
Created October 21, 2022 10:33
ubuntu .desktop label template
[Desktop Entry]
Version=1.0
Name=название
Comment=описание
Exec=/путь/к/исполняемому/файлу
Icon=/путь/к/иконке
Terminal=false
Type=Application
Categories=категории
@wipermail
wipermail / How to replace a string in multiple files in linux command line
Created January 15, 2023 13:53
How to replace a string in multiple files in linux command line
Similar to Kaspar's answer but with the g flag to replace all the occurrences on a line.
find ./ -type f -exec sed -i 's/old_string/new_string/g' {} \;
For global case insensitive:
find ./ -type f -exec sed -i 's/old_string/new_string/gI' {} \;
@wipermail
wipermail / wp_save_image_by_url.php
Created February 19, 2023 18:03
Wordpress. Save Image With PHP
<?php
function houzez_property_img_upload_houzi_import( $img_url ): array {
$upload_dir = wp_upload_dir();
$image_data = file_get_contents( $img_url );
$filename = basename( $img_url );
if ( wp_mkdir_p( $upload_dir['path'] ) ) {
Простое клонирование
CREATE TABLE new_table SELECT * FROM original_table;
Поверхностное клонирование
CREATE TABLE new_table LIKE original_table;
Глубокое клонирование
CREATE TABLE new_table LIKE original_table;
INSERT INTO new_table SELECT * FROM original_table;
SELECT order_id,product_name,qty
FROM orders
WHERE foo = 'bar'
INTO OUTFILE '/var/lib/mysql-files/orders.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n';
Note: That syntax may need to be reordered to
SELECT order_id,product_name,qty
@wipermail
wipermail / gen_pass.txt
Created April 3, 2023 13:30
Password Generation Examples
openssl rand -base64 32
@wipermail
wipermail / chng_pass_user_mysql.sql
Created April 3, 2023 13:37
change password mysql user
ALTER USER 'userName'@'localhost' IDENTIFIED BY 'New-Password-Here';
@wipermail
wipermail / Who is listening on a port in Linux.txt
Created May 13, 2023 16:36
Who is listening on a port in Linux
sudo lsof -i :номер_порта
sudo netstat -lntup
Опишем все ключи, которые используются в команде
-l показать только прослушиваемые "LISTEN" порты.
-n показывать адреса как ip, а не пытаться определять домены.
-t показывать TCP порты.
-u показывать UDP порты.
-p показать название программы, которая слушает порт.
@wipermail
wipermail / gist:df12c915e36fe1d6fdbb29fb2643db04
Created July 10, 2023 10:29
MacOs Apple Silicon JetBrains Product Flickering when doing something
Help | Edit Custom VM options
-Dsun.java2d.metal=false