Skip to content

Instantly share code, notes, and snippets.

View fracasula's full-sized avatar
🏋️‍♂️
One pomodoro after another

Francesco Casula fracasula

🏋️‍♂️
One pomodoro after another
View GitHub Profile
@fracasula
fracasula / xdebug.ini
Created May 28, 2014 10:38
Xdebug sample configuration
zend_extension=xdebug.so
xdebug.default_enable = On
xdebug.profiler_enable = On
xdebug.profiler_output_dir = "/tmp/xdebug"
xdebug.profiler_append = On
xdebug.profiler_enable_trigger = On
xdebug.profiler_output_name = "%u_%p.profile.xlog"
@fracasula
fracasula / git.sh
Last active July 13, 2017 14:21
Git Vademecum - AKA Cheat Sheet
# Create a branch
cd master/
git branch branch_name
git checkout branch_name
git push origin branch_name
# Create and switch to a new branch
cd master/
git checkout -b branch_name
git push origin branch_name
@fracasula
fracasula / mysql_update_join.sql
Created March 12, 2015 14:48
Update with Join in MySQL
UPDATE TABLEA a
JOIN TABLEB b ON a.join_colA = b.join_colB
SET a.columnToUpdate = [something]
@fracasula
fracasula / xdebug
Last active September 26, 2017 14:20
PHP Xdebug script for having debugging features available quickly on demand
#!/bin/bash
# Copy this file on /usr/loca/bin/xdebug and test your PHP configuration with "xdebug -i | grep -i xdebug"
XDEBUG_CONFIG="idekey=PHPSTORM" php \
-dxdebug.remote_host=`echo $SSH_CLIENT | cut -d "=" -f 2 | awk '{print $1}'` \
-dxdebug.remote_enable=On \
-dxdebug.remote_connect_back=On \
-dxdebug.remote_port=9000 \
"$@"
@fracasula
fracasula / proxy.js
Last active November 28, 2019 16:12
Node.js basic example for proxy to http server
/**
* Once this is running open your browser and hit http://localhost
* You'll see that the request hits the proxy and you get the HTML back
*/
'use strict';
const net = require('net');
const http = require('http');
@fracasula
fracasula / setup.sh
Last active May 14, 2021 16:28
How to install Bluejeans on Ubuntu
sudo apt install alien -y
sudo alien --scripts bluejeans_1.28.9-2_amd64.rpm # or whatever is the file you downloaded from the bluejeans website
sudo dpkg -i bluejeans_1.28.9-2_amd64.deb
cd /lib/x86_64-linux-gnu
sudo ln -s libudev.so libudev.so.0
# now you can launch bluejeans
/opt/bluejeans/bluejeans-bin
@fracasula
fracasula / keymap.cson
Created March 8, 2018 16:11
My Atom keymap file
'atom-text-editor':
'ctrl-d': 'editor:delete-line'
'ctrl-y': 'editor:duplicate-lines'
'ctrl-w': 'core:close'
@fracasula
fracasula / context_cancel.go
Last active May 19, 2022 20:49
GoLang exiting from multiple go routines with context and wait group
package main
// Here's a simple example to show how to properly terminate multiple go routines by using a context.
// Thanks to the WaitGroup we'll be able to end all go routines gracefully before the main function ends.
import (
"context"
"fmt"
"math/rand"
"os"
@fracasula
fracasula / cond.go
Created August 3, 2018 14:11
GoLang: How to use sync.Cond
package main
import (
"sync"
"fmt"
"time"
)
func main() {
lock := sync.Mutex{}
const flattenArray = input => {
if (!Array.isArray(input)) {
throw new Error("Input must be an array")
}
let result = []
for (let element of input) {
if (Array.isArray(element)) {
result = result.concat(flattenArray(element))
} else {