Skip to content

Instantly share code, notes, and snippets.

🎧
‌‌

Wagner Souza waghcwb

🎧
‌‌
Block or report user

Report or block waghcwb

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
@waghcwb
waghcwb / encoding-video.md
Created Aug 8, 2019 — forked from Vestride/encoding-video.md
Encoding video for the web
View encoding-video.md

Encoding Video

Installing

Install FFmpeg with homebrew. You'll need to install it with a couple flags for webm and the AAC audio codec.

brew install ffmpeg --with-libvpx --with-libvorbis --with-fdk-aac --with-opus
@waghcwb
waghcwb / delete-slack-messages.js
Last active Jun 3, 2019 — forked from firatkucuk/delete-slack-messages.js
Deletes slack public/private channel and chat messages.
View delete-slack-messages.js
#!/usr/bin/env node
// Channel ID is on the the browser URL.: https://mycompany.slack.com/messages/MYCHANNELID/
// Pass it as a parameter: node ./delete-slack-messages.js CHANNEL_ID
// CONFIGURATION #######################################################################################################
const token = '<token>'; // You can learn it from: https://api.slack.com/custom-integrations/legacy-tokens
// GLOBALS #############################################################################################################
View fresh-install-windows.md

choco install 7zip.install

choco install putty.install

choco install nodejs.install

choco install skype

choco install python2

View convertToSeconds.js
// timeFormat = 'mm:ss'
function convertToSeconds(time) {
const [ minutes, seconds ] = time.split(':')
const minutesToSeconds = (Number(minutes) * 60)
return minutesToSeconds + Number(seconds)
}
@waghcwb
waghcwb / encrypt.js
Last active Apr 19, 2019 — forked from vlucas/encryption.js
Stronger Encryption and Decryption in Node.js
View encrypt.js
const crypto = require('crypto')
function encrypt(text) {
let key
let iv = crypto.randomBytes(16)
let hash = crypto.createHash('sha1')
hash.update(text)
return hash.digest().slice(0, 16).toString('hex')
View save-blob.js
const link = document.getElementById('link')
const data = { username: 'waghcwb' }
const json = JSON.stringify(data, null, 2)
const blob = new Blob([json], { type: 'octet/stream' })
const url = window.URL.createObjectURL(blob)
link.href = url
link.download = 'username.json'
View range-function.js
/**
* range()
*
* Returns an array of numbers between a start number and an end number incremented
* sequentially by a fixed number(step), beginning with either the start number or
* the end number depending on which is greater.
*
* @param {number} start (Required: The start number.)
* @param {number} end (Required: The end number. If end is less than start,
* then the range begins with end instead of start and decrements instead of increment.)
View getArrayOfDoubles.js
function getArrayOfDoubles(size = 30, factor = 0.5) {
return Array(size).fill(0).map((item, index) => Number((index * factor).toFixed(1))).splice(1)
}
View await-global.js
function awaitGlobal(keys, wait = 300) {
return Promise.all(
[].concat(keys).map(key => {
return new Promise((resolve, reject) => {
let timer
const loop = () => {
if (key.indexOf('.') > -1) {
try {
let __key = key.split('.')[0]
if (root[__key]) {
View prettier-only-staged.sh
# runs prettier only in modified files on git
git diff --name-only | xargs prettier --config ./prettier.config.js --write
You can’t perform that action at this time.