Skip to content

Instantly share code, notes, and snippets.

View nilportugues's full-sized avatar

Nil Portugués Calderó nilportugues

View GitHub Profile
@nilportugues
nilportugues / graphql.ts
Created July 9, 2019 09:31 — forked from mfellner/graphql.ts
Using Apollo Server in Next.js 9 with API route in pages/api/graphql.ts
import { ApolloServer, gql } from 'apollo-server-micro';
const typeDefs = gql`
type Query {
sayHello: String
}
`;
const resolvers = {
Query: {
@nilportugues
nilportugues / registry-minio.md
Created June 21, 2019 09:56 — forked from leanderjanssen/registry-minio.md
Docker Registry with Minio storage example

Running a docker registry with Minio S3 backend

Run minio in a container

docker run -d -p 9000:9000 --name minio minio/minio server /export

Use docker logs to retrieve access key and secret key from minio container

docker logs minio

Create config.yml for Docker Registry

This file will have to be mounted to /etc/docker/registry/config.yml

@nilportugues
nilportugues / notes.md
Created May 8, 2019 22:42 — forked from joejag/notes.md
Notes from Non Violent Communication by Marshall B. Rosenberg

Foreword

Insprired by Gandhi

He told his grandson that violence is more than fighting, beating, killing & wars.

Made him split what he did into "Physcial" and "Passive". With a tree structure. Kept it up to date each day. Passive violence leads to psychical violence.

Words are Windows (or they're Walls)

Chapter 1: Giving From the Heart

@nilportugues
nilportugues / proxylist.txt
Last active April 30, 2019 22:30
proxylist.txt
Spys.one/Twitter@spys_one/Telegram@spys_one
51.83.45.138:80 FR-H -
18.234.138.124:80 US-H
149.28.72.14:3128 US-H +
203.150.160.80:8080 TH-N-S +
3.122.189.222:80 US-H -
170.0.92.83:46629 AR-H-S! -
23.20.214.120:3128 US-N-S! +
151.80.36.115:8080 FR-A-S! -
139.192.88.74:8080 ID-N-S +
@nilportugues
nilportugues / detectNonEnglishWord.js
Created April 19, 2019 10:31
detectNonEnglishWord.js
var detectNonEnglishWord = function (text) {
var regex = /^([A-Za-z\-'\. _.,!"\?'])*/g;
return text.replace(regex, "").split(" ");
};
console.log(detectNonEnglishWord("Hello?!! 足下コンクリート"))

It seems that it does not matter what timezone is on the server as long as you have the time set right for the current timezone, know the timezone of the datetime columns that you store, and are aware of the issues with daylight savings time.

On the other hand if you have control of the timezones of the servers you work with then you can have everything set to UTC internally and never worry about timezones and DST.

Here are some notes I collected of how to work with timezones as a form of cheatsheet for myself and others which might influence what timezone the person will choose for his/her server and how he/she will store date and time.

MySQL Timezone Cheatsheet

@nilportugues
nilportugues / DetectAdBlock.js
Created May 14, 2018 16:10 — forked from hotdang-ca/DetectAdBlock.js
Detect AdBlockers from a React Component
/**
*
* Detect Ad Blockers
*
* Copyright (c) 2017 James Robert Perih
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
@nilportugues
nilportugues / gitstars.json
Created February 8, 2018 15:09
github stars manager for production
{"tags":[],"lastModified":1518102547785}
# to cut first 3 seconds and length 8 seconds (custom step done for each file)
ffmpeg -ss 3 -t 8 -i VID00080.MP4 -vcodec copy -acodec copy white.MP4
# to burn in the timecode (r=framerate) (use in loop like below)
# ffmpeg -i $MOVIE -vf "drawtext=fontfile=/Users/artsyinc/Library/Fonts/PxPlus_VGA_SquarePx.ttf: fontsize=128: timecode='00\:00\:00\:00': r=30: x=(w-tw)/2: y=h-(2*lh): fontcolor=white: box=1: boxcolor=0x00000000@1" timecode/$MOVIE
# to speed up
for MOVIE in $(ls | grep MP4);
do LENGTH=$(ffprobe -i $MOVIE -show_format -loglevel quiet | egrep -oE 'duration=(\d+)' | awk -F= '{print $2}');
RATIO=$(echo 7.0/$LENGTH | bc -l);
@nilportugues
nilportugues / sqliteToMySQL.pl
Created January 9, 2018 22:26
sqliteToMySQL.pl
#! /usr/bin/perl
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.