Skip to content

Instantly share code, notes, and snippets.

CREATE USER 'USERNAME'@'%' IDENTIFIED BY 'PASSWORD';
GRANT ALL PRIVILEGES ON DATABASE_NAME.* TO 'USERNAME'@'%';
FLUSH PRIVILEGES;
@soft2help
soft2help / localidades.csv
Last active January 15, 2026 09:02
Todas las localidades de España- comunida, Provincia, Localidad, Latitud, Longitud, Altitud, Total Habitantes, Hombres, Mujeres
We can't make this file beautiful and searchable because it's too large.
Andalucía;Almería;Abla;37.14114;-2.780104;871.1684;1504;783;721
Andalucía;Almería;Abrucena;37.13305;-2.797098;976.9387;1341;682;659
Andalucía;Almería;Adra;36.74807;-3.022522;10.97898;24373;12338;12035
Andalucía;Almería;Albánchez;37.2871;-2.181163;481.3123;815;422;393
Andalucía;Almería;Alboloduy;37.03319;-2.62175;388.4346;674;334;340
Andalucía;Almería;Albox;37.38979;-2.147483;426.4268;11178;5731;5447
Andalucía;Almería;Alcolea;36.97449;-2.961038;744.6956;908;486;422
Andalucía;Almería;Alcóntar;37.33585;-2.596944;955.1331;603;315;288
Andalucía;Almería;Alcudia de Monteagud;37.23598;-2.266174;1018.354;141;74;67
Andalucía;Almería;Alhabia;36.9893;-2.587667;288.056;724;363;361
@soft2help
soft2help / findMostRecentFile.bat
Created August 31, 2021 14:36
Windows Batch Find Most Recent Modified File
set Path="C:\tmp\"
for /f "tokens=*" %%a in ('dir /A:-D /B /O:-D /S %Path%') do set NEW=%%a&& goto:n
:n
echo %NEW%
@soft2help
soft2help / deleteFilesMoreOlderThan.bat
Created August 31, 2021 14:34
Windows batch delete Files More Older Than X Days
set folder = "C:\tmp"
set fileExtension = ".txt"
set daysOlder = 90
forfiles -p %folder% -s -m *%fileExtension% /D -%daysOlder% /C "cmd /c del @path"
@soft2help
soft2help / compilePhpWebSockets.txt
Created August 25, 2021 10:05
php compilation to allow thousands of websocket connections
cd ~
sudo apt-get update
sudo apt install libldap2-dev
sudo apt install apache2-dev
sudo apt install libgmp-dev
sudo ln -sf /usr/lib/x86_64-linux-gnu/libldap.so /usr/lib/libldap.so
sudo ln -sf /usr/lib/x86_64-linux-gnu/liblber.so /usr/lib/liblber.so
sudo ln -sf /usr/include/x86_64-linux-gnu/gmp.h /usr/include/gmp.h
wget https://github.com/php/php-src/archive/php-7.2.2.tar.gz
tar --extract --gzip --file php-7.2.2.tar.gz
@soft2help
soft2help / OTE.sql
Created July 27, 2021 09:44
Territorial organization in Spain (Comunidades, Provincias, Localidades)
/*
This is the table with inserts about territorial organization in spain (Comunidades, provincias, localidades)
https://es.wikipedia.org/wiki/Organizaci%C3%B3n_territorial_de_Espa%C3%B1a
Organización territorial de España
*/
create table if not exists OTEComunidad
(
Comunidad varchar(256) not null,
Id int auto_increment
primary key
@soft2help
soft2help / braces-in-same-line.json
Last active July 27, 2021 09:36
Braces (curly braces) in same line in visual code
// in first place you should install domir.regreplace and enable it after in your settings.json inside .vscode folder or in global settings
// Each time that the file is save it will put first brace in same line of declaration
//in here i use it to php file but can be any file that you want. check the extension documentation https://marketplace.visualstudio.com/items?itemName=DomiR.regreplace
{
"regreplace.commands": [
{
"name": "brace on same line",
"match": "\\.php?$",
"regexp": "\\)(\\s*)\\n(\\s*)\\{(\\s*)\\n",
"global": true,
@soft2help
soft2help / refreshProject.ps1
Created July 27, 2021 09:07
Powershell script to bring or refresh project from remote to local
#refresh project folder to help your ide for example from remote ssh access server,
#you should have 7zip tool to windows and also your certificate to ssh server access
#check how get certificate https://gist.github.com/soft2help/1a037fc08ade3be87418ce50a0383063
#you should place in folder that will containt project folder in your localproject
#Usually i put it inside the folder .vscode folder and call it from a shortcut that i have in my powershell modules check https://github.com/soft2help/powershell-profile
#of course that you can use this script to update local from remote any folder that you want, this is an example with vendor
#PAY ATTENTION BECAUSE IN FIRST LINE OF SCRIPT REMOVE EVERYTHING EXCEPTS THE .vscode FOLDER, before download it from the remote
Get-ChildItem -Path '*' -Recurse | Where-Object {($_.FullName -notlike "*.vscode*")} | Remove-Item -Recurse -ErrorAction SilentlyContinue
Remove-Item -Recurse -Force project.tar.gz -ErrorAction SilentlyContinue
@soft2help
soft2help / ppk_to-id_rsa.md
Last active July 27, 2021 09:37
How Convert a ppk certificate to id_rsa (openssh) certificate

Can be use full for scp or ssh command line, usually i use it to connect with my aws machines. This is another security layer with security groups. Check the image to see instructions to convert your ppk file which you already use to connect with your instance to id_rsa file (openssh) in this gist https://gist.github.com/soft2help/50574f23996f79ffc19712a1efb53d34 we use it to refresh vendor folder in a php project How get id_rsa from ppk

@soft2help
soft2help / installs3fs.sh
Created May 17, 2020 10:29
install s3fs to mpa a folder with a s3 bucket location. you should create iam user to access it
#!/bin/bash
apt-get update -y
apt-get install -yqq automake autotools-dev fuse g++ git libcurl4-openssl-dev libfuse-dev libssl-dev libxml2-dev make pkg-config
cd /home
if [ ! -d "/home/s3fs-fuse" ] ; then
git clone https://github.com/s3fs-fuse/s3fs-fuse.git
cd s3fs-fuse
./autogen.sh
./configure
make