Skip to content

Instantly share code, notes, and snippets.

View Leeaandrob's full-sized avatar
🏠
Working from home

Leandro Barbosa Leeaandrob

🏠
Working from home
  • Rio de Janeiro
View GitHub Profile
@Leeaandrob
Leeaandrob / certbot.sh
Created May 16, 2024 15:11 — forked from fideloper/certbot.sh
Certbot on Ubuntu, wildcard subdomains via CloudFlare DNS challenge
# Used on Ubuntu 18.04 and 20.04
# Find instructions for other OSes here: https://certbot.eff.org/instructions
# Install Certbot via Snaps
sudo snap install core; sudo snap refresh core
sudo snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/bin/certbot
# Install DNS CloudFlare plugin
sudo snap set certbot trust-plugin-with-root=ok
@Leeaandrob
Leeaandrob / ffmpeg.sh
Created April 25, 2024 01:51 — forked from prabindh/ffmpeg.sh
FFMPEG commands for multimedia operations, streaming, and interop with CUDA/OpenGL
#Creating SBS (side by side) videos:
ffmpeg -i input_file -i input_file2 -filter_complex hstack -vcodec libx264 -b:v 30M -vsync 0 output.mp4
#MP4 from raw YUV
ffmpeg -f rawvideo -vcodec rawvideo -s 1920x1080 -pix_fmt yuv420p -i input.yuv -c:v libx264 -preset slow -qp 0 -vsync 0 -pix_fmt nv12 output.mp4
#Scaling:

Upscale 1080p to 4k using ffmpeg

Just use the command below:

ffmpeg -i INPUT_FILE \
  -vf scale=3840x2160:flags=lanczos \
  -c:v libx264 \
  -crf 13 \
 -c:a aac -b:a 512k \
@Leeaandrob
Leeaandrob / gist:f73df051b09bf3ea4cce755ac29a67f1
Created September 28, 2023 13:44
docker-mongodb_redis.yaml
version: '3.7'
services:
db:
container_name: db_mongo
image: mongo
ports:
- "27017:27017"
volumes:
- mongodata:/data/db
import json
from flask import Flask, request, Response
from pymongo import MongoClient
app = Flask(__name__)
client = MongoClient("mongodb://localhost:27017")
news_c = client.portal.news
@app.route("/", methods=["GET"])
def root():
import json
from flask import Flask, Response, request
app = Flask(__name__)
data = {"products": []}
@app.route("/", methods=["GET"])
def hello_world():
return "HELLO Guilherme"

Building GCC 9.2.0 on CentOS 7

Introduction

CentOS 7 distribution (as well as RHEL 7) ships with a somewhat outdated version of the GCC compiler (4.8.5 on CentOS 7.5), which may not be suitable to your compilation requirements. For example, C11 - which supersedes C99 - is fully supported only starting from GCC 4.9).

Additionally, recent versions of GCC (GCC6, GCC7, GCC8, GCC9) come with improvements which help detect issues at build time and offer suggestions on how to fix them. Sometimes, these are even actually helpful!

This note describes how to build the latest GCC (9.2.0 as of October 2019) from sources on CentOS 7. This should be applicable as is on RHEL 7. For other Linux distributions, adapt as needed.

@Leeaandrob
Leeaandrob / index.js
Created March 24, 2021 19:18 — forked from bzhr/index.js
import React from "react";
import ReactDOM from "react-dom";
import ApolloClient from "apollo-client";
import { ApolloProvider } from "@apollo/react-hooks";
import { ApolloLink, fromPromise, Observable } from "apollo-link";
import { onError } from "apollo-link-error";
// import "./index.css";
import App from "./App";
import * as serviceWorker from "./serviceWorker";
import { createUploadLink } from "apollo-upload-client";
if (p2pml.core.HybridLoader.isSupported()) {
let config = P2P(props.cid, props.duration > 0 ? props.duration: 120, props.p2p);
if ((this.state.nav == "firefox" || this.state.nav == "chrome" || this.state.nav == "opera") && !props.encrypted) {
setup.shakaOnBeforeLoad = function(shakaPlayerInstance) {
config.loader.xhrSetup = function(xhr, url) {
xhr.setRequestHeader("Authorization", `Bearer ${cidJWT}`);
};
var engine = new p2pml.shaka.Engine(config);
// model
// Ladder struct used to store ladder
type Ladder struct {
Model
Name string `json:"name" bson:"name"`
Profiles Profiles `json:"profiles" bson:"profiles"`
Kind string `json:"kind" bson:"kind"`
UserID string `json:"userId" bson:"userId"`
LivepeerID string `json:"livepeerID" bson:"livepeerID"`