Skip to content

Instantly share code, notes, and snippets.

View gregtap's full-sized avatar
🐬

Gregory TAPPERO gregtap

🐬
  • @Silvr-co
  • Paris
View GitHub Profile
@gregtap
gregtap / test.sql
Created September 17, 2020 20:38
SQL aggregated rolling sum
WITH example AS (
SELECT '2020-04-15' AS start_date, 6000.00 AS amount, "e63e55f4-eadf-4c3d-8a99-0ec524b0dbb7" AS fun_id
UNION ALL SELECT '2020-04-21', 7000.00 ,"e63e55f4-eadf-4c3d-8a99-0ec524b0dbb7"
UNION ALL SELECT '2020-05-04', 13000.00 ,"e63e55f4-eadf-4c3d-8a99-0ec524b0dbb7"
UNION ALL SELECT '2020-05-28', 4000.00 ,"e63e55f4-eadf-4c3d-8a99-0ec524b0dbb7"
UNION ALL SELECT '2020-08-05', 30000.00 ,"e63e55f4-eadf-4c3d-8a99-0ec524b0dbb7"
UNION ALL SELECT '2020-05-04', 1962.00 ,"89ba98b9-a4fa-41f3-9015-4e3cc29961ad"
UNION ALL SELECT '2020-07-16', 4038.00 ,"89ba98b9-a4fa-41f3-9015-4e3cc29961ad"
UNION ALL SELECT '2020-07-20', 10000.00 ,"ce257ea2-1a0c-42ff-9d1c-ea2073846628"
UNION ALL SELECT '2020-08-31', 25000.00 ,"9f38de3d-4cd7-4950-9d6d-5ddf68c67c20"
@gregtap
gregtap / madness
Created June 30, 2020 14:24
Mailjet Answer
There is a new answer to your ticket number n°1296311 waiting on your account.
Hi,
Thanks that you made your request more clear.
Because of security purposes we cannot provide you the exact RegExp mechanism which validated the email recipients.
For RegExp we validate if it\'s a RFC compliant email address.
We accept only existing registered top level domains after the dot - domain.comladosxxx69
(?:[a-z0-9!#$%&\'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&\'*+/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+(?:aaa|aarp|abarth|abb|abbott|abbvie|abc|able|abogado|abudhabi|ac|academy|accenture|accountant|accountants|aco|actor|ad|adac|ads|adult|ae|aeg|aero|aetna|af|afamilycompany|afl|africa|ag|agakhan|agency|ai|aig|airbus|airforce|airtel|akdn|al|alfaromeo|alibaba|alipay|allfinanz|allstate|ally|alsace|alstom|am|amazon|americanexpress|americanfamily|amex|amfam|amica|amsterdam|analytics|android|anquan|anz|ao
# Cloudflare Argo Sidecard
- name: tunnel
image: visibilityspots/cloudflared
imagePullPolicy: Always
command: ["cloudflared", "tunnel"]
args:
- --url=http://127.0.0.1:8500
- --hostname=api.chefclub.io
- --lb-pool=api-lb-pool
- --origincert=/etc/cloudflared/cert.pem
# This file contains custom Compose sequences for Unicode characters
# Import default sequences from the system Compose file:
include "/usr/share/X11/locale/en_US.UTF-8/Compose"
<Multi_key> <e> <e> : "é" eacute
<Multi_key> <i> <e> : "ê" ecircumflex
<Multi_key> <i> <i> : "î" icircumflex
<Multi_key> <i> <o> : "ô" ocircumflex
let parsePrismicHomepageResponse = itemsResult => {
switch (itemsResult->Option.getWithDefault(Result.Ok(None))) {
| Error(_e) => None
| Ok(itemsOption) =>
switch (itemsOption) {
| None => None
| Some(items) =>
let parsed =
items->Array.map(item =>
item##data##body
@gregtap
gregtap / main.go
Created September 26, 2019 16:45
dumb redirect
package main
import (
"fmt"
"net/http"
"os"
)
var targetDomain = fmt.Sprintf("%s", getEnv("TARGET_DOMAIN", "https://google.com"))
@gregtap
gregtap / test.py
Last active April 30, 2019 12:25
testing googleplay API
from googleapiclient.discovery import build
from oauth2client.service_account import ServiceAccountCredentials
import httplib2
http = httplib2.Http(timeout=30)
credentials = ServiceAccountCredentials.from_json_keyfile_name(
"credentials.json", "https://www.googleapis.com/auth/androidpublisher"
)
http = credentials.authorize(http)
@gregtap
gregtap / doom-fire.py
Created February 11, 2019 19:52
Doom fire /rpi-rgb-led-matrix test
from rgbmatrix import RGBMatrix, RGBMatrixOptions, graphics
import itertools as it
from time import sleep
import random
import colorsys
from PIL import Image
from PIL import ImageDraw
mode = 0
import firebase_admin
from firebase_admin import credentials, messaging
cred = credentials.Certificate("/Users/greg/Downloads/chefclub-notifications-test-1-firebase-adminsdk-0qqbs-7cb7b7b6c4.json")
firebase_admin.initialize_app(cred)
# This registration token comes from the client FCM SDKs.
registration_token = 'cjNg-fBsWsE:APA91bEc-pDmnfkyczdJroTv-KNHpucA7WhYrmxWrgcSz4HHqn5vhodglqI3mqUSZnz0_VhuJjCrvGUVyqbRR-YnP8DuxdeHQyp1BUiF-H2V2ockNJ2OO-yEh6Im2EFhI6KHUd3ettEg'
# See documentation on defining a message payload.
@gregtap
gregtap / sprite.py
Last active September 18, 2018 19:39
sprite led
from PIL import Image
from PIL import ImageDraw
import time
from rgbmatrix import RGBMatrix, RGBMatrixOptions
# Configuration for the matrix
options = RGBMatrixOptions()
options.rows = 32
options.chain_length = 6
options.parallel = 1