Skip to content

Instantly share code, notes, and snippets.

View gabrieledarrigo's full-sized avatar
😃
Smiling

Gabriele D'Arrigo gabrieledarrigo

😃
Smiling
View GitHub Profile
@gabrieledarrigo
gabrieledarrigo / poller.go
Created December 2, 2023 11:38 — forked from nhocki/poller.go
Simple task scheduling with Redis & Go. Similar to Sidekiq's `perform_in` and `perform_at`.
// poller.go
package main
import (
"fmt"
"os"
"os/signal"
"time"
function App ({ id, values }) {
const [user, setUser] = useState(null);
const payload = {
id,
...values,
// compute some stuff
};
useEffect(() => {
fetch(`/users/${params.id}`, {
@gabrieledarrigo
gabrieledarrigo / writeJSONWithDrain.js
Created January 12, 2022 13:33
Write JSON in a for loop, it causes a memory leak
const fs = require('fs');
const path = require('path');
const NUMBER_OF_ROWS = process.env.NUMBER_OF_ROWS || 100_000_000;
const JSON_OUTPUT = path.resolve(__dirname, `data_${Date.now()}.ndjson`);
const { info, error } = console;
(async () => {
function writeJSON() {
@gabrieledarrigo
gabrieledarrigo / druid_environment
Created December 15, 2021 20:20
Druid environment
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
@gabrieledarrigo
gabrieledarrigo / CODEMOTION_TECH_DEBT_PANEL.md
Last active May 4, 2021 15:49
Codemotion "tech debt" panel

Codemotion Challenges 4 DEVS

Ridurre il debito tecnico della vostra applicazione

Domande

  • Cos’è per te il debito tecnico? Come lo definisci e, soprattutto, che effetti ha nella tua esperienza?

  • Una volta constatato che nella tua applicazione esiste del debito tecnico, cosa fai per ridurlo? Ci sono delle pratiche o degli strumenti che nella tua esperienza si sono rivelati particolarmente utili?

  • Uno dei problemi principali del debito tecnico è probabilmente la difficoltà di comunicarlo a persone che non hanno un background tecnico. Ti è capitato di scontrarti con questo problema? Come l’hai risolto? Che altri problemi ti è capitato di affrontare nella gestione del debito tecnico?

nslookup

Ultima modifica: Jun 13, 2020 12:30 PM tags: Università

nslookup

nslookup is a powerful network administration command-line tool, available for many of the popular computer operating systems for querying DNS to obtain domain names or IP addresses, mapping or for any other specific DNS Records.Here are the ten most used command lines with nslookup that will help you to understand better your domain's management.

1. How to find the A record of the domain?

@gabrieledarrigo
gabrieledarrigo / grass.rs
Created June 2, 2020 17:47
Grass command line utility
use structopt::StructOpt;
use std::io::Error;
#[derive(Debug, StructOpt)]
struct Cli {
pattern: String,
#[structopt(parse(from_os_str))]
path: std::path::PathBuf,
}
@gabrieledarrigo
gabrieledarrigo / useNotifications.jsx
Created May 15, 2020 18:00
A draft for a notifications hooks
import React, { useReducer } from 'react';
const uuid = () => Math.random();
export function reducer(state, action) {
switch (action.type) {
case 'show':
return [
action.notification,
...state,
@gabrieledarrigo
gabrieledarrigo / reversePolish.js
Created March 29, 2020 11:18
Reverse polish notation algorithm
/**
Author's note: This is the algorithm taken from https://en.wikipedia.org/wiki/Reverse_Polish_notation
for each token in the postfix expression:
if token is an operator:
operand_2 ← pop from the stack
operand_1 ← pop from the stack
result ← evaluate token with operand_1 and operand_2
push result back onto the stack
else if token is an operand:
@gabrieledarrigo
gabrieledarrigo / .bash_profile
Created February 12, 2019 13:32
My bash profile
export PS1='\[\e[0;33m\]\h:\W \u\$\[\e[m\] '
export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced
alias ll="ls -la"
export PATH="/Users/gabrieledarrigo/Library/Android/sdk/platform-tools":$PATH
export JAVA_JOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_162.jdk/Contents/Home
export GROOVY_HOME=/usr/local/opt/groovy/libexec
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm