Skip to content

Instantly share code, notes, and snippets.

-- Create Tables -------------------------------------------------------
CREATE TABLE employments (
id integer GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
name text NOT NULL,
department text NOT NULL,
salary integer NOT NULL
);
CREATE UNIQUE INDEX employments_pkey ON employments(id int4_ops);
@nolleto
nolleto / SLACK-SENDING-MESSAGE.md
Last active November 23, 2023 20:19
This a tutorial how to send a slack message to yourself... for debugging
  1. Go to "Your Apps" page at https://api.slack.com/apps

  2. Click on "Create New App" button

  3. On the modal, click on "From scratch" to create a new app from scratch

  4. In the "App Name" you can put any name in your app and in "Pick a workspace to develop your app in:" choose a workspace were you want to receive the messages.

image

const sleepSort = (arr) => {
const { length } = arr
const result = []
return new Promise((resolve) => {
for (let index = 0; index < length; index++) {
const value = arr[index];
setTimeout(() => {
result.push(value)
@nolleto
nolleto / perfec-numeber.js
Last active March 30, 2020 13:10
Check if number is perfect
const getAllDivisors = n => {
const divisors = []
let currentNumber = 1
while (currentNumber < n) {
if ((28 % currentNumber) === 0) {
divisors.push(currentNumber)
}
currentNumber++
}
@nolleto
nolleto / bayesjs-bench.js
Created March 23, 2020 12:08
Benchmark os bayesjs algorithm
const { inferAll } = require("bayesjs");
const { clone } = require("ramda");
const network = JSON.parse(
'{"node1":{"id":"node1","states":["T","F"],"parents":["node25","node13","node16","node17","node37"],"cpt":[{"when":{"node25":"T","node13":"T","node16":"T","node17":"T","node37":"T"},"then":{"T":0.99,"F":0.01}},{"when":{"node25":"F","node13":"T","node16":"T","node17":"T","node37":"T"},"then":{"T":0.01,"F":0.99}},{"when":{"node25":"T","node13":"F","node16":"T","node17":"T","node37":"T"},"then":{"T":0.99,"F":0.01}},{"when":{"node25":"F","node13":"F","node16":"T","node17":"T","node37":"T"},"then":{"T":0.01,"F":0.99}},{"when":{"node25":"T","node13":"T","node16":"F","node17":"T","node37":"T"},"then":{"T":0.99,"F":0.01}},{"when":{"node25":"F","node13":"T","node16":"F","node17":"T","node37":"T"},"then":{"T":0.01,"F":0.99}},{"when":{"node25":"T","node13":"F","node16":"F","node17":"T","node37":"T"},"then":{"T":0.99,"F":0.01}},{"when":{"node25":"F","node13":"F","node16":"F","node17":"T","node37":"T"},"then":{"T":0
@nolleto
nolleto / netflix-activity.js
Last active February 4, 2019 17:47
The purpose of this gist it is to create the easiest way to remove a lot of series or shows without needing to click one by one. This script adds a button the render a modal with your activities grouped.
/**
* How does this script work?
* You open the 'My Activity' (https://www.netflix.com/viewingactivity) page on
* Netflix then open the browser's console and paste the full script and press 'Enter'.
* This will create an 'Erase activities' button beside the title. Clicking on
* the button a dialog will open asking how many times the button 'Show More'
* should be clicked before opening a modal with your activity history in a modal.
* If you put a number, the 'Show More' button will be hit, when the load
* completes it will be hit again. Many times you wish.
* After that, a modal will open with a table with all your series, movies and
@nolleto
nolleto / tipper.rb
Created June 13, 2018 13:33
Updace overview
class Tipper
TAX = 0.05
def initialize(amount:, discount_percentage: 0, tip_percentage:)
@amount = amount
@discount_percentage = discount_percentage
@tip_percentage = tip_percentage
end
def total
const getSize = matrix => ({
width: matrix[0].length,
height: matrix.length
})
const goDiagonally = (func, matrix, columnLimit) => (line, column) => {
while (line >= 0) {
matrix[line][column] = func()
line--
#include <stdio.h>
#include <stdlib.h>
struct elemento {
int mat;
struct elemento *ant;
};
typedef struct elemento Elemento;
int veririficar_vazia(Elemento *pilha);
import java.sql.Date;
import java.text.SimpleDateFormat;
import java.util.*;
public class Troquinhos {
public static int Intervalo = 100;
public static void main(String[] args) {
long inicio = System.currentTimeMillis();