Skip to content

Instantly share code, notes, and snippets.

View simone-sanfratello's full-sized avatar

Simone Sanfratello simone-sanfratello

View GitHub Profile
@simone-sanfratello
simone-sanfratello / TIPS.md
Last active March 2, 2024 08:24
Tips & Tricks collection

Tips & Tricks collection

Command aliases

git

  • add origin named "upstream" to the forked repo
git remote add upstream https://github.com/OWNER/REPOSITORY.git
@simone-sanfratello
simone-sanfratello / README.md
Last active February 28, 2024 09:50
Rust project setup

Rust project setup


Create a new project

cargo new project-name
cargo new project-name --lib
@simone-sanfratello
simone-sanfratello / sort.js
Created January 19, 2022 10:28
quicksort matrix
const t = require('tap')
const cases = [
{
matrix: [3, 5, 1, 3, 6, 2],
cols: 1,
result: [1, 2, 3, 3, 5, 6]
},
{
@simone-sanfratello
simone-sanfratello / xmodmap.md
Last active January 7, 2023 14:46
xmodmap Italian accents on linux / ubuntu

Get Italian accent vowels and euro symbol

Right Ctrl + A > á
Right Ctrl + E > é
Right Ctrl + I > í
Right Ctrl + O > ó
Right Ctrl + U > ú
AtrGr + E > €
@simone-sanfratello
simone-sanfratello / server-aborted-request.js
Last active October 13, 2021 20:53
server aborted request
const http = require('http')
const PORT = 3000
const server = http.createServer((req, res) => {
req.on('aborted', () => {
console.log('>>>>>> server event request aborted')
})
res.writeHead(200, { 'Content-Type': 'text/plain' })
@simone-sanfratello
simone-sanfratello / app.js
Created October 29, 2020 09:21
benchmark express.static etag
var express = require('express')
var app = express()
const etag = process.argv[2] == 'ON'
app.listen(9876, () => process.stdout.write('start'))
app.use(express.static('public', { etag }));
@simone-sanfratello
simone-sanfratello / notes.md
Created September 2, 2020 12:50
Ubuntu 20 tricks
  • flush dns
sudo systemd-resolve --flush-caches
@simone-sanfratello
simone-sanfratello / forward.js
Last active July 24, 2020 07:40
node.js training
const http = require('http')
const baseUrl = 'httpbin.org'
http.createServer((request, response) => {
const forward = http.request({
host: baseUrl,
path: request.url,
method: request.method,
headers: request.headers
@babel
:registry=https://registry.npmjs.org
registry=https://pkgs.dev.azure.com/companyname/FrontendProject/_packaging/RegistryName/npm/registry/
always-auth=true
; begin auth token
//https://pkgs.dev.azure.com/companyname/FrontendProject/_packaging/RegistryName/npm/registry/:username=simone
//https://pkgs.dev.azure.com/companyname/FrontendProject/_packaging/RegistryName/npm/registry/:_password=password
//https://pkgs.dev.azure.com/companyname/FrontendProject/_packaging/RegistryName/npm/registry/:email=npm requires email to be set but doesn't use the value

find . -name "node_modules" -type d -prune -exec rm -rf '{}' +