Skip to content

Instantly share code, notes, and snippets.

View marco-souza's full-sized avatar
🦕

Marco Antônio marco-souza

🦕
View GitHub Profile
@marco-souza
marco-souza / cloudSettings
Last active June 23, 2021 15:30
MacOS - Visual Studio Code - Settings Sync Gist
{"lastUpload":"2021-06-23T15:30:45.087Z","extensionVersion":"v3.4.3"}
@marco-souza
marco-souza / moneyFormatter.js
Created July 2, 2018 21:19
Format a simple number to Reais
function formatMoney(n) {
return "R$ " + n.toFixed(2).replace('.', ',').replace(/(\d)(?=(\d{3})+\,)/g, "$1.");
}
// or (ES6)
const formatMoney = n => `R$ ${n.toFixed(2).replace('.', ',').replace(/(\d)(?=(\d{3})+\,)/g, "$1.")}`
@marco-souza
marco-souza / wp-permission-updater.sh
Created July 6, 2018 14:41
Update WordPress permissions
chown www-data:www-data -R * # Let Apache be owner
find . -type d -exec chmod 755 {} \; # Change directory permissions rwxr-xr-x
find . -type f -exec chmod 644 {} \; # Change file permissions rw-r--r--
const getList = classname => [...document.getElementsByClassName(classname)]
.map(i => i.currentSrc)
.filter(i => String(i).includes(`frame`))
.map(i => i.replace(`_frame1.jpg`, ''))
.map(i => i.replace(`https://78.media.tumblr.com/`, ''))
.map(i => i.replace(`_frame1.jpg`, ''))
.map(i => `https://vtt.tumblr.com/${i}_480.mp4`)
const getVideos = () => getList('picture')
@marco-souza
marco-souza / steps.md
Last active August 6, 2018 18:56
Arch server

Settup Anarchist Server

  1. Fix etc/locale.gen to add pt_BR.UTF8 and run sudo locale-gen to generate it.

  2. Install yaourt

  3. Update system

  4. Install other programs

@marco-souza
marco-souza / tests.py
Last active August 10, 2018 15:00
Teste
# 1 - Bitmap
# Complete the decompress function below.
def decompress(linesAsStringArray):
result_line = ''
for line in linesAsStringArray:
while line:
sep, rep = line[:2]
line = line[2:]
result_line += (sep * int(rep))
result_line += '\n'
// WARNING: it sould be runned in http://www.brazil-help.com/brazilian_states.htm
// to get the same results
const list_brazilien_states = () => {
const trs = document.querySelectorAll('.MsoNormalTable tr')
let data = []
trs.forEach((tr, index) => {
if (index > 3) {
const tds = tr.getElementsByTagName('td')
@marco-souza
marco-souza / ext.md
Last active November 27, 2018 15:53
vscode extension list

General

  • Atom keymap
  • Code Runner
  • Comments Anchor
  • DotENV
  • EditorConfig for VS Code
  • gitignore
  • GitLens

xdotool - tool to fake system inputs.

Some commands using xdotool

play/pause

  • xdotool key XF86AudioPlay
@marco-souza
marco-souza / downloadCSV.js
Created June 10, 2019 22:01
Download CSV form string
export function downloadCSV(CSVText, filename) {
const link = document.createElement('a');
link.setAttribute('href', window.URL.createObjectURL(
new Blob([CSVText]),
{ type: 'text/plain' }
));
link.setAttribute('download', `${filename}.csv`);
document.body.appendChild(link); // Required for FF
link.click();
document.body.removeChild(link);