Skip to content

Instantly share code, notes, and snippets.

View thedarsideofit's full-sized avatar

Diego Alcides Ramirez thedarsideofit

View GitHub Profile
@thedarsideofit
thedarsideofit / jurisdictionsParser.php
Created December 30, 2022 14:33
Script to parse a list of jurisdictions - (created by chatGPT with some personal enhancements)
<?php
// Your code here!
$text = "Alameda01 Alameda CACCS
Alpine02 Alpine CACCS
Amador03 Amador CACCS
Butte04 Butte CACCS
Calavera05 Calaveras CACCS
CCosta07 Contra Costa CACCS
Colusa06 Colusa CACCS
@thedarsideofit
thedarsideofit / gist:8c85c94e7ee76a77839dd2a67cbe3ece
Created October 26, 2021 15:47
Import from CSV File to MySQL
-- Go the CSVs path and then connect to the MySQL Server
mysql --user=YOURUSER --password=YOURPASSWORD --host=localhost --local-infile=1 YOURDATABASE
LOAD DATA LOCAL INFILE 'YOURFILENAME.csv'
INTO TABLE YOURTABLE
FIELDS TERMINATED by ','
LINES TERMINATED BY '\n';
//Poner esta fórmula en Google Sheets
//F13 sería la url = https://www.byma.com.ar/especie/irc9o/
=INDEX(IMPORTXML(F13,"//ul[@class='species-values']//span"),1)
//Alternativa si necesitan formatear el texto a número reemplaza '.' por '' y ',' por '.'
=SUBSTITUTE(SUBSTITUTE(INDEX(IMPORTXML(F13,"//ul[@class='species-values']//span"),1),".",""),",",".")
@thedarsideofit
thedarsideofit / php-apcu-bc_on_ubuntu_16.04.md
Created September 27, 2019 04:38 — forked from philbot9/php-apcu-bc_on_ubuntu_16.04.md
Install php-acpu-bc on Ubuntu 16.04

The php-apcu-bc package provides a backwards compatibility layer from apcu -> apc, and is reuqired for some older PHP code bases (e.g. Yii 1). The package is not (yet) available in the Ubuntu 16.04 repos. To install it, use php-pear:

sudo apt-get install php-dev php-pear
sudo pecl install apcu_bc-beta

Then edit /etc/php/7.0/apache2/php.ini and add the following at the end of the file:

@thedarsideofit
thedarsideofit / freetds_install_ubuntu_14.md
Created January 14, 2019 22:44 — forked from ghalusa/freetds_install_ubuntu_14.md
Installing and Configuring FreeTDS on Ubuntu 14.04.4 LTS and Establish a Connection via PHP PDO

Installing and Configuring FreeTDS on Ubuntu 14.04.4 LTS and Establish a Connection via PHP PDO


Install

sudo apt-get install -y unixodbc unixodbc-dev unixodbc-bin libodbc1 odbcinst1debian2 tdsodbc php5-odbc
@thedarsideofit
thedarsideofit / prestashop.conf
Last active December 2, 2018 13:28 — forked from julienbourdeau/prestashop.conf
PrestaShop Nginx Configuration
server {
listen 80;
listen [::]:80; #Use this to enable IPv6
server_name www.example.com;
root /var/www/prestashop17;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
index index.php index.html;
@thedarsideofit
thedarsideofit / prestashop-customers-orders.sql
Last active October 28, 2018 06:28
prestashop-customers-orders
SELECT `id_customer`,`id_gender`, `birthday`, `newsletter`, `optin`, `date_add`, `date_upd`,
(SELECT count(id_order)
FROM `ps_orders` inner join ps_order_state on ps_orders.current_state = ps_order_state.id_order_state
WHERE ps_orders.id_customer = ps_customer.id_customer and ps_order_state.paid = 1) orders
FROM `ps_customer`
WHERE 1
ORDER BY orders DESC
@thedarsideofit
thedarsideofit / presta-logging.php
Created May 13, 2018 23:32
Debug GET POST logging array prestashop
//Fuente http://vblanch.com/logging-to-file-in-prestashop/?lang=es
$logger = new FileLogger(0); //0 == nivel de debug. Sin esto logDebug() no funciona.
$logger->setFilename(_PS_ROOT_DIR_."/log/debug.log");
$logger->logDebug("Nueva Petición variables GET");
$logger->logDebug(print_r($_GET, true));
$logger->logDebug("Nueva Petición variables POST");
$logger->logDebug(print_r($_POST,true));
SELECT COUNT( ID ) AS usuarios, DATE_FORMAT( created_at, '%Y/%m' ) AS fecha
FROM `fos_user`
WHERE 1
GROUP BY DATE_FORMAT( created_at, '%Y/%m' )
LIMIT 0 , 30
@thedarsideofit
thedarsideofit / buscar-repetidos-actualizar-dominios.sql
Last active April 17, 2018 13:07
buscar-repetidos-actualizar-dominios.sql
--Verificar si va a haber emails repetidos al cambiar todos a @yopmail
-------------------------------------------------------------------------------------------------
SELECT REPLACE(email, SUBSTRING_INDEX(email, '@', -1), 'yopmail.com') as nuevo_email, count(*) as cant
FROM `email`
GROUP BY nuevo_email
HAVING cant > 1
--Actualizar todos los emais a @yopmail
-------------------------------------------------------------------------------------------------