Skip to content

Instantly share code, notes, and snippets.

View simone-sanfratello's full-sized avatar

Simone Sanfratello simone-sanfratello

View GitHub Profile
const si = require('systeminformation');
(async () => {
console.log('cpu speed', await si.cpuCurrentspeed())
console.log('cpu temperatrue', await si.cpuTemperature())
console.log('memory', await si.mem())
console.log('disk', await si.fsSize())
})()
@simone-sanfratello
simone-sanfratello / .gitignore
Created November 4, 2019 07:39
nodejs gitignore file
# derived
/build
/dist
/test/output
/coverage
/output
# npm, yarn
/node_modules
/npm-debug.log
@simone-sanfratello
simone-sanfratello / launch.json
Created July 31, 2019 12:04
vscode launch collection
{
"version": "0.2.0",
"configurations": [{
"type": "node",
"request": "launch",
"name": "Test",
"program": "${workspaceFolder}/node_modules/jest/bin/jest.js",
"env": {
"NODE_ENV": "test"
},
@simone-sanfratello
simone-sanfratello / init.sh
Last active July 23, 2019 07:27
Debian 9 VPS setup
locale-gen en_US.UTF-8 && dpkg-reconfigure locales
adduser simone
apt upgrade && apt upgrade
dpkg-reconfigure tzdata
apt install sudo
usermod -aG sudo simone
apt-get install software-properties-common
reboot
const csv = require('csv-parser')
const fs = require('fs')
function esc (str) {
return str.replace(/'/g, "''")
}
function main () {
const rows = []
fs.createReadStream('file.csv')
@simone-sanfratello
simone-sanfratello / mute-spoty.cfg.js
Last active March 11, 2019 10:08
mute spotify on matching title
{
"list": [
"spotify",
"meer info",
"consegna gratuita",
"scopri di pi",
"advertisement",
"ascolta adesso",
"power it",
"hits unlimited",
@simone-sanfratello
simone-sanfratello / fix.sh
Created August 2, 2018 04:35
[FIX] Thunderbird big emoji on Ubuntu 18
# https://ubuntu-mate.community/t/thunderbird-with-huge-icons-emoticons-mate-18-04/16249/22
cd /tmp
wget https://raw.githubusercontent.com/mozilla/positron/master/browser/fonts/EmojiOneMozilla.ttf
sudo mkdir /usr/lib/thunderbird/fonts
sudo mv /tmp/EmojiOneMozilla.ttf /usr/lib/thunderbird/fonts/
@simone-sanfratello
simone-sanfratello / csv.js
Created June 27, 2018 08:47
query result to csv
const fs = require('fs-extra')
function csv (result, file) {
const _content = []
let _header = false
for (const row of result) {
const _line = []
for (const field in row) {
if (!_header) {
_line.push('"' + field + '"')
@simone-sanfratello
simone-sanfratello / mute-spotify-spot.js
Last active June 29, 2018 09:53
mute on spotify spots
#!/usr/bin/env node
/**
* @todo write default settings file if not exists
* @todo mute only spotify channel
*/
const cprocess = require('child_process')
const fs = require('fs')
const path = require('path')
@simone-sanfratello
simone-sanfratello / script.sh
Created April 10, 2018 04:25
bash collection
# base64 image encode
echo "data:image/jpeg;base64,$(base64 -w 0 image.jpg)"