Skip to content

Instantly share code, notes, and snippets.

🏋
One pomodoro after another

Francesco Casula fracasula

🏋
One pomodoro after another
Block or report user

Report or block fracasula

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@fracasula
fracasula / Instructions.md
Last active Nov 16, 2019
Lenovo Legion Y540 configuration for Debian 10 (buster) with kernel 5.2
View Instructions.md

This is a WIP

  • Use rufus to create USB pen to avoid "Detect and mount CDROM issue"
  • Disable Discrete graphics and UEFI from the BIOS
  • Download the WLAN firmware from here
  • Login as root in recovery mode
  • Install the WLAN firmware downloaded before and reboot, you should now be able to connect via Ethernet (not WiFi)
  • Re-enable the release file in /etc/apt/sources.list in case it was disabled
  • Add your user to the sudoers (e.g. usermod -aG sudo francesco)
  • Enable all repositories contrib non-free in /etc/apt/sources.list (see here)
@fracasula
fracasula / encrypt_decrypt.go
Last active Nov 12, 2019
A simple example with Golang that uses AES-128 to encrypt and decrypt messages.
View encrypt_decrypt.go
package mycrypto
import (
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"encoding/base64"
"io"
"time"
)
View flattenArray.js
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 {
@fracasula
fracasula / cond.go
Created Aug 3, 2018
GoLang: How to use sync.Cond
View cond.go
package main
import (
"sync"
"fmt"
"time"
)
func main() {
lock := sync.Mutex{}
@fracasula
fracasula / context_cancel.go
Last active Oct 15, 2019
GoLang exiting from multiple go routines with context and wait group
View context_cancel.go
package main
// Here we show how to properly terminate multiple go routines by using a context.
// Thanks to WaitGroup we'll be able to end all go routines gracefully before the main function ends.
import (
"fmt"
"os"
"context"
"sync"
@fracasula
fracasula / keymap.cson
Created Mar 8, 2018
My Atom keymap file
View keymap.cson
'atom-text-editor':
'ctrl-d': 'editor:delete-line'
'ctrl-y': 'editor:duplicate-lines'
'ctrl-w': 'core:close'
@fracasula
fracasula / setup.sh
Last active Oct 28, 2019
How to install Bluejeans on Ubuntu
View setup.sh
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 / proxy.js
Last active Apr 1, 2019
Node.js basic example for proxy to http server
View proxy.js
/**
* 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 / xdebug
Last active Sep 26, 2017
PHP Xdebug script for having debugging features available quickly on demand
View xdebug
#!/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 / .bash_aliases
Last active Mar 8, 2018
Colourful bash
View .bash_aliases
if [ -f /etc/bash_completion ]; then
source /etc/bash_completion
fi
# wget https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -O ~/.git-completion.bash
if [ -f ~/.git-completion.bash ]; then
source ~/.git-completion.bash
fi
# wget https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh -O ~/.git-prompt.sh
You can’t perform that action at this time.