Skip to content

Instantly share code, notes, and snippets.

View robertoentringer's full-sized avatar
🖥️
Working from home

Roberto Entringer robertoentringer

🖥️
Working from home
View GitHub Profile
@robertoentringer
robertoentringer / convert-seconds.js
Created April 13, 2019 03:42 — forked from martinbean/convert-seconds.js
Convert seconds to HH:MM:SS format in JavaScript.
new Date(seconds * 1000).toISOString().substr(11, 8)
@robertoentringer
robertoentringer / splitter.js
Created April 13, 2019 14:38 — forked from nlac/splitter.js
A small js snippet to split a merged audio track to parts by silence analysis. Based on ffmpeg "silencedetect" filter and node.js.
/**
* This javascript snippet is able to split a merged audio track to parts by silence analysis
* It is based on ffmpeg (https://ffmpeg.org), especially on the silencedetect filter (https://ffmpeg.org/ffmpeg-filters.html#silencedetect)
*
* Assumptions:
* - nodejs is installed
* - ffmpeg is installed
*
* Usage:
* - fill the options object
@robertoentringer
robertoentringer / chrome-i18n.js
Created May 6, 2019 13:28 — forked from eligrey/chrome-i18n.js
Easy i18n for your Chrome extensions and apps' DOM.
/* Chrome DOM i18n: Easy i18n for your Chrome extensions and apps' DOM.
* 2011-06-22
*
* By Eli Grey, http://eligrey.com
* Public Domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/
/*jslint laxbreak: true, strict: true*/
/*global self, chrome, document*/
@robertoentringer
robertoentringer / git-clearHistory
Created May 6, 2019 17:55 — forked from stephenhardy/git-clearHistory
Steps to clear out the history of a git/github repository
-- Remove the history from
rm -rf .git
-- recreate the repos from the current content only
git init
git add .
git commit -m "Initial commit"
-- push to the github remote repos ensuring you overwrite history
git remote add origin git@github.com:<YOUR ACCOUNT>/<YOUR REPOS>.git
@robertoentringer
robertoentringer / index.js
Created May 7, 2019 15:04 — forked from zkat/index.js
npx is cool
#!/usr/bin/env node
console.log('yay gist')
@robertoentringer
robertoentringer / README.md
Last active May 12, 2019 00:16
Bash script to clear out the history of a git/github repository.

Call directly from your terminal

$ bash <(curl -s https://gist.githubusercontent.com/robertoentringer/c9e327479f012bafeaeaaf48d3966aaf/raw)
@robertoentringer
robertoentringer / remote_bash.sh
Created May 11, 2019 23:58 — forked from n0ts/remote_bash.sh
execute bash script from remote site
# http://stackoverflow.com/questions/5735666/execute-bash-script-from-url
bash <(curl -s http://mywebsite.com/myscript.txt)
# http://stackoverflow.com/questions/4642915/passing-parameters-to-bash-when-executing-a-script-fetched-by-curl
curl http://foo.com/script.sh | bash -s arg1 arg2
@robertoentringer
robertoentringer / .eslintrc-chrome-ext.js
Last active June 2, 2019 14:28
My eslint config to working with prettier.
module.exports = {
env: {
commonjs: true,
browser: true,
es6: true
},
extends: ["eslint:recommended", "plugin:prettier/recommended"],
globals: {
Atomics: "readonly",
SharedArrayBuffer: "readonly",
@robertoentringer
robertoentringer / arrow-destructuring.js
Last active June 21, 2019 12:18
Destructuring alias and default value
//https://medium.com/data-scraper-tips-tricks/create-an-object-from-another-in-one-line-es6-96125ec6c834
let person = {
name: "John",
surname: "Doe",
age: 24,
job: "developer"
}
let john = (({age, job}) => ({age, job}))(person)
@robertoentringer
robertoentringer / node-and-npm-in-30-seconds.sh
Created June 17, 2019 14:38 — forked from isaacs/node-and-npm-in-30-seconds.sh
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh