Skip to content

Instantly share code, notes, and snippets.

View ff6347's full-sized avatar
🤖
updating status…

Fabian Morón Zirfas ff6347

🤖
updating status…
View GitHub Profile
//@ts-check
import got from "got";
import stream from "stream";
import zlib from "zlib";
import fs from "fs";
const fileList = ["file.gz", "file1.gz", "file2.gz", "file3.gz"];
const tmpFolderPath = "/tmp";
async function main() {
const transferTasks = fileList.map(
@ff6347
ff6347 / pg_random_int_array.sql
Created May 17, 2021 14:56 — forked from ekho/pg_random_int_array.sql
Postgresql function for generating random integer array
CREATE OR REPLACE FUNCTION random_int_array(dim integer, min integer, max integer) RETURNS integer[] AS $BODY$
begin
return (select array_agg(round(random() * (max - min)) + min) from generate_series (0, dim));
end
$BODY$ LANGUAGE plpgsql;
-- usage example
select random_int_array(15, 6, 40);
-- return example
@ff6347
ff6347 / .gistup
Last active April 27, 2021 06:23
gistup
@ff6347
ff6347 / select-random-pairs-from-list.js
Created January 26, 2021 08:16
select random pairs from list
//@ts-check
function shuffle(array) {
array.sort(() => Math.random() - 0.5);
return array;
}
function main() {
let names = [
"Babbit and Catstello",
@ff6347
ff6347 / emitter-in-p5.js
Created January 8, 2021 17:52
emitter-in-p5.js
let x = 0;
let canvas = undefined;
const emitter = new Emitter();
emitter.on("action", (data) => {
console.log(`hello action on ${JSON.stringify(data)}`);
fill(data.fill);
rect(random(width), random(height), 10, 10);
});
@ff6347
ff6347 / api.http
Created October 27, 2020 06:02
Nerdy Weeks - Ex "The Real Deal" HTTP Requests for VSCode REST
### See https://github.com/Huachao/vscode-restclient
### for some deeper insight
GET http://localhost:3000?foo=bah
###
GET http://localhost:3000/healthcheck
### Cats
@ff6347
ff6347 / how-to-copy-aws-rds-to-local.md
Created July 2, 2020 08:45 — forked from syafiqfaiz/how-to-copy-aws-rds-to-local.md
How to copy production database on AWS RDS(postgresql) to local development database.
  1. Change your database RDS instance security group to allow your machine to access it.
    • Add your ip to the security group to acces the instance via Postgres.
  2. Make a copy of the database using pg_dump
    • $ pg_dump -h <public dns> -U <my username> -f <name of dump file .sql> <name of my database>
    • you will be asked for postgressql password.
    • a dump file(.sql) will be created
  3. Restore that dump file to your local database.
    • but you might need to drop the database and create it first
    • $ psql -U <postgresql username> -d <database name> -f <dump file that you want to restore>
  • the database is restored
@ff6347
ff6347 / nexus-test-environment.js
Created June 25, 2020 17:35 — forked from Weakky/nexus-test-environment.js
SQLite jest environment for Nexus & Prisma
// tests/nexus-test-environment.js
const NodeEnvironment = require('jest-environment-node')
const { nanoid } = require('nanoid')
const util = require('util')
const exec = util.promisify(require('child_process').exec)
const fs = require('fs')
const path = require('path')
const prismaBinary = './node_modules/.bin/prisma'
data
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
@ff6347
ff6347 / Dockerfile
Created April 15, 2020 08:10 — forked from cilf/Dockerfile
Adminer MongoDB docker image
FROM adminer:4.7.1
# WATCH OUT WHEN UPGRADING, THE SED BELOW MIGHT STOP WORKING
MAINTAINER [email protected]
USER root
RUN apk add autoconf gcc g++ make libffi-dev openssl-dev
RUN pecl install mongodb
RUN echo "extension=mongodb.so" > /usr/local/etc/php/conf.d/docker-php-ext-mongodb.ini