Skip to content

Instantly share code, notes, and snippets.

View TheHiddenHaku's full-sized avatar

Alessio Bottiroli TheHiddenHaku

View GitHub Profile
@TheHiddenHaku
TheHiddenHaku / wp_change_domain_queries.sql
Last active May 2, 2019 09:06
Wordpress change domain queries
UPDATE
wp_options
SET
option_value = replace(option_value, 'http://www.old-domain.com', 'http://www.new-domain.com')
WHERE
option_name = 'home' OR
option_name = 'siteurl';
#option_name = 'wsl_settings_redirect_url';
UPDATE
@TheHiddenHaku
TheHiddenHaku / get_headers_from_curl_response.php
Created May 11, 2015 13:30
Get Curl response headers as associative array
/**
* Questo metodo prende l'header di una response e restituisce un array associativo
* @param $response
* @return array
*/
private function get_headers_from_curl_response($response)
{
$headers = array();
$header_text = substr($response, 0, strpos($response, "\r\n\r\n"));
foreach (explode("\r\n", $header_text) as $i => $line) {
curl -X PURGE -H 'X-Forwarded-Proto: https' url
<?php
// Next two functions taken from a commenter on http://php.net/manual/en/function.unserialize.php
function unserialize_recursive($val) {
//$pattern = "/.*\{(.*)\}/";
if(is_serialized($val)){
$val = trim($val);
$ret = unserialize($val);
if (is_array($ret)) {
foreach($ret as &$r) $r = unserialize_recursive($r);
@TheHiddenHaku
TheHiddenHaku / diff.sh
Last active August 29, 2015 14:15
diff csv
paste file1 file2 | awk -F "[,\t]" '{for(i=1;i<=(NF/2);i++){if($i != $(NF/2+i)){
if(s){s=s";"$i}else{s=$i}}else{if(s){s=s";,"}else{s=","}}}}{ print s;s=""}'
@TheHiddenHaku
TheHiddenHaku / apache_modules_dupm
Created January 27, 2015 12:25
Apache Dump Modules
apachectl -t -D DUMP_MODULES
@TheHiddenHaku
TheHiddenHaku / 0_reuse_code.js
Last active August 29, 2015 14:11
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@TheHiddenHaku
TheHiddenHaku / mcled.ino
Last active August 29, 2015 14:10
Arduino Music Controlled LED
// SOUND REACTIVE LED TEST by Antinum
// Don't abruptly steal, but a comment in your source code crediting me is fine.
// HOWEVER this code is probably quite messy and can be tweaked quite a bit
// Have fun with this, though :)
//FOUND FROM THIS YOUTUBE VIDEO http://youtu.be/c3DFLFITaG0
const byte totalLeds=11;
int incomingAudio[30]={};
int averageAudio=0;
# Why rewrite URLs? Read this: http://en.wikipedia.org/wiki/Rewrite_engine
# Apache (.htaccess or httpd.conf)
# Make sure AllowOverride is on for the directory, or put the rewrite rules in httpd.conf
# http://httpd.apache.org/docs/2.0/mod/core.html#allowoverride
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . /index.php [L]
# Nginx (nginx.conf)
@TheHiddenHaku
TheHiddenHaku / recursive_unserialize.php
Last active August 29, 2015 14:08 — forked from SimonEast/gist:1117476
Recursive unserialize functions
<?php
// Next two functions taken from a commenter on http://php.net/manual/en/function.unserialize.php
function unserialize_recursive($val) {
//$pattern = "/.*\{(.*)\}/";
if(is_serialized($val)){
$val = trim($val);
$ret = unserialize($val);
if (is_array($ret)) {
foreach($ret as &$r) $r = unserialize_recursive($r);