This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| # https://youtu.be/UV8EBsnU-GQ | |
| import os, sqlite3, getpass | |
| MASTER_PASSWORD = '123' | |
| def clear_console(): | |
| os.system('cls' if os.name=='nt' else 'clear') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| wget "https://github.com/jingweno/ccat/releases/download/v1.1.0/linux-amd64-1.1.0.tar.gz" | |
| tar xfz linux-amd64-1.1.0.tar.gz | |
| chmod +x ./linux-amd64-1.1.0/ccat | |
| mv ./linux-amd64-1.1.0/ccat /usr/local/bin/ | |
| rm -rf linux-amd64-1.1.0.tar.gz ./linux-amd64-1.1.0 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| clear | |
| # GET | |
| curl -s -X GET http://localhost:8080/endpoint?nome=fulano&idade=22 | jq | |
| # form-urlencoded | |
| curl -s -X POST http://localhost:8080/endpoint -H "Content-Type: application/x-www-form-urlencoded" --data "name=fulano&idade=20" | jq | |
| # json |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| from requests import get | |
| from datetime import datetime, timedelta | |
| import json | |
| class PacktPub: | |
| @classmethod | |
| def get_packtpub_offers(cls, date: datetime = datetime.today()) -> dict: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # @mgechev | |
| # A bash function I use constantly on airports: | |
| # Unlimited WiFi ✨ | |
| changeMac() { | |
| local mac=$(openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//') | |
| sudo ifconfig en0 ether $mac | |
| sudo ifconfig en0 down | |
| sudo ifconfig en0 up | |
| echo "Your new physical address is $mac" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Atribuição básica | |
| const company = { name: 'Google', country: 'USA' }; | |
| const { name } = company; | |
| // Desestruturação em parâmetros de funções | |
| function messageSender({ from }) { | |
| console.log('From:', from) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="pt-br"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
| <title>Vanilla JS Masks</title> | |
| <style> | |
| label, input { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const obj = { | |
| nome: 'fulano', | |
| idade: 20 | |
| }; | |
| const generateIterator = obj => obj[Symbol.iterator] = () => { | |
| const keys = Object.keys(obj) | |
| let i = 0; | |
| return ({ | |
| next() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export class List<T> extends Array<T> { | |
| constructor(...args: T[]) { | |
| super(...args); | |
| Object.setPrototypeOf(this, List.prototype); | |
| } | |
| private get self() { | |
| return Object.getPrototypeOf(this).constructor; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* jshint esnext: true */ | |
| const { fetch, HttpClient } from './request.js'; | |
| const { map } = require('rxjs/operators'); | |
| const url = 'http://jsonplaceholder.typicode.com/users/1'; | |
| fetch(url) | |
| .then(JSON.parse) | |
| .then(r => r.address) | |
| .then(console.log); |