Skip to content

Instantly share code, notes, and snippets.

View viniciusCamargo's full-sized avatar
🧙‍♂️

Vinicius de Sousa Camargo viniciusCamargo

🧙‍♂️
View GitHub Profile
@viniciusCamargo
viniciusCamargo / fastapi_websocket_redis_pubsub.py
Created December 25, 2020 21:36 — forked from timhughes/fastapi_websocket_redis_pubsub.py
FastAPI Websocket Bidirectional Redis PubSub
"""
Usage:
Make sure that redis is running on localhost (or adjust the url)
Install uvicorn or some other asgi server https://asgi.readthedocs.io/en/latest/implementations.html
pip install -u uvicorn
Install dependencies
@viniciusCamargo
viniciusCamargo / go-quick-install.txt
Created August 20, 2020 15:19
go quick install - ubuntu
wget https://golang.org/dl/go1.15.linux-amd64.tar.gz
tar -zxvf go1.15.linux-amd64.tar.gz
mkdir gopath
cat <<'EOT' >> .profile
export GOROOT=$HOME/go
export GOPATH=$HOME/gopath
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
ffmpeg -i input.mov -vf fps=15,scale=600:-1:flags=lanczos,palettegen palette.png
ffmpeg -i input.mov -i palette.png -filter_complex "\
fps=15,scale=600:-1:flags=lanczos[x];\
[x][1:v]paletteuse output.gif
@viniciusCamargo
viniciusCamargo / typed_closure_with_generic.ts
Created February 19, 2019 09:27
ts nice closure pattern
// response: Response. import 'isomorphic-fetch';
// map: import { map } from 'rxjs/operators';
const bodyMap = <T>() => map<T, FormattedResponse<T>>((body: T) => ({ response, body }));
return from(response.arrayBuffer()).pipe(bodyMap<ArrayBuffer>());
@viniciusCamargo
viniciusCamargo / preact.html
Created February 14, 2019 13:28
Preact without JSX + lifecycle methods
<!-- Reference: https://github.com/developit/preact-without-babel/ -->
<!DOCTYPE html>
<html lang="en">
<head>
<style>
#header {
opacity: 1;
transition: opacity 1s;
}
@viniciusCamargo
viniciusCamargo / gist:d6bcf4819e4e608ea80bd879402ee559
Created December 9, 2018 11:44
Git: push to a different remote branch
git remote add [name-of-the-remote] [https-repository-url]
git remote set-url [name-of-the-remote] [ssh-repository-url] # avoid enter password every push
git push [name-of-the-remote] [name-of-the-local-branch]:[name-of-the-remote-branch]
Reference:
https://stackoverflow.com/a/6565661
https://stackoverflow.com/a/13897766
@viniciusCamargo
viniciusCamargo / CMakeLists.txt
Created November 22, 2018 18:04 — forked from fracek/CMakeLists.txt
CMake and GTK+ 3
# Set the name and the supported language of the project
PROJECT(hello-world C)
# Set the minimum version of cmake required to build this project
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
# Use the package PkgConfig to detect GTK+ headers/library files
FIND_PACKAGE(PkgConfig REQUIRED)
PKG_CHECK_MODULES(GTK3 REQUIRED gtk+-3.0)
# Setup CMake to use GTK+, tell the compiler where to look for headers
@viniciusCamargo
viniciusCamargo / .prettierrc
Last active February 15, 2021 12:45
.prettierrc
{
"jsxBracketSameLine": true,
"quoteProps": "consistent"
}
@viniciusCamargo
viniciusCamargo / firebase-react-auth.js
Created June 29, 2018 11:46
Firebase with React login and sign up
import React, { Component, Fragment } from 'react'
import firebase from 'firebase/app'
import 'firebase/auth'
import './style.css'
// TODO: whitelist the domain in the API manager:
// https://plus.google.com/u/0/+MichaelPrentice/posts/7T65U83ncfT?sfc=true
// "This is found in https://console.cloud.google.com under API Manager -> Credentials -> Browser Key -> Key
// Restrictions. Of course you have to select an active project before performing this navigation."
@viniciusCamargo
viniciusCamargo / index.html
Created June 13, 2018 04:33
firestore chat poc
<html>
<header>
<title>firestore realtime vanillajs</title>
</header>
<body>
<h1>new message</h1>
<div id="messages"></div>