Skip to content

Instantly share code, notes, and snippets.

🦀

Tiago Celestino tcelestino

🦀
Block or report user

Report or block tcelestino

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
View qr-code-gsheets.txt
=IMAGE(“https://chart.googleapis.com/chart?chs=200×200&cht=qr&chl=”&A2&””)
View cloudflare-dns.md

Cloudflare DNS

  • Serviço padrão:
    • DNS primário: 1.1.1.1
    • DNS secundário: 1.0.0.1
  • Filtro de malware:
    • DNS primário: 1.1.1.2
    • DNS secundário: 1.0.0.2
  • Filtro de malware e conteúdo adulto:
    • DNS primário: 1.1.1.3
View reducer-without-switch.js
function reducers(state = initState, action) {
const mapping = {
[ACTION_ONE]: { ...state, token: action.payload },
[ACTION_TWO]: { ...state, error: action.payload }
};
return mapping[action.type] || state;
}
View randomString.js
const secret = `${Math.random().toString(36).slice(2)}`;
View duplicating-repo.md

Mirroring a repository

Open Terminal.

Create a bare clone of the repository.

$ git clone --bare https://github.com/exampleuser/old-repository.git
@tcelestino
tcelestino / anagram.js
Created Jul 17, 2019
solutions to code interviews
View anagram.js
// helper function that builds the
// object to store the data
const buildCharObject = str => {
const charObj = {}
for(let char of str.replace(/[^\w]/g).toLowerCase()) {
// if the object has already a key value pair
// equal to the value being looped over,
// increase the value by 1, otherwise add
// the letter being looped over as key and 1 as its value
charObj[char] = charObj[char] + 1 || 1
@tcelestino
tcelestino / essentials-docker-commands.md
Last active Jun 14, 2019
Essentials Docker commands -
View essentials-docker-commands.md

Essentials Docker commands

List all essentials command to use Docker. Based on https://hackernoon.com/docker-commands-the-ultimate-cheat-sheet-994ac78e2888

Running Docker

  • docker start [container]: Start a particular container.
  • docker stop [container]: Stop a particular container.
  • docker exec -ti [container] [command]: Run a shell command inside a particular container.
  • docker run -ti — image [image] [container] [command]: Create and start a container at the same time, and then run a command inside it.
@tcelestino
tcelestino / delete-files-netstorage.js
Created Jun 3, 2019
remove files in images directory at Akamai NetStorage
View delete-files-netstorage.js
const deleteImagesFolder = () => {
ns.dir('/cpCode/front-app-home/images', (error, res, body) => {
if (error) {
throw new Error(`Error, ${error.message}`);
}
if (body.stat !== undefined) {
const { file: files } = body.stat;
files.forEach(file => {
@tcelestino
tcelestino / docker-clean.sh
Created May 20, 2019
alias to docker clean out
View docker-clean.sh
# docker
alias dockercleand='docker rmi $(docker images -q)' #delete all images
alias dockercleanu='docker rmi $(docker images -q -f dangling=true)' # delete all untagged images
alias dockercleans='docker rm $(docker ps -a -q)' #delete all stopped images
@tcelestino
tcelestino / sanitize.js
Created May 14, 2019
remove accents, switch white-space from hifen and transform string in lowercase
View sanitize.js
const sanitize = str => str.normalize('NFD').replace(/[\u0300-\u036f]/g, '').replace(' ', '-').toLowerCase();
You can’t perform that action at this time.