Skip to content

Instantly share code, notes, and snippets.

Working from home

Marlos marlosirapuan

Working from home
  • João Pessoa, PB - Brazil
View GitHub Profile
marlosirapuan / mime.types
Last active May 4, 2022
NGINX Config - Content-Security-Policy (Google, Google Fonts, Facebook, Zendesk, MaxCDN-FontAwesome, CKEditor), Cache, Mime-Types, Puma
View mime.types
# /etc/nginx/mime.types
types {
font/ttf ttf;
font/opentype otf;
text/html html htm shtml;
text/css css;
text/xml xml;
image/gif gif;
image/jpeg jpeg jpg;
application/javascript js;
marlosirapuan / 🎵 My last week in music
Last active Mar 4, 2022
🎵 My last week in music
View 🎵 My last week in music
Dream Theater ██▌░░░░░░░░░░░░░░ 2 plays
Fates Warning ██▌░░░░░░░░░░░░░░ 2 plays
Airbag ██▌░░░░░░░░░░░░░░ 2 plays
Green Carnation █▎░░░░░░░░░░░░░░░ 1 plays
Shadow Gallery █▎░░░░░░░░░░░░░░░ 1 plays
Ayreon █▎░░░░░░░░░░░░░░░ 1 plays
Redemption █▎░░░░░░░░░░░░░░░ 1 plays
Threshold █▎░░░░░░░░░░░░░░░ 1 plays
Riverside █▎░░░░░░░░░░░░░░░ 1 plays
Big Big Train █▎░░░░░░░░░░░░░░░ 1 plays
marlosirapuan / file-upload.tsx
Created Apr 30, 2021 — forked from Sqvall/file-upload.tsx
File Upload with Chakra UI and react-hook-form
View file-upload.tsx
import { ReactNode, useRef } from 'react'
import { Button, FormControl, FormErrorMessage, FormLabel, Icon, InputGroup } from '@chakra-ui/react'
import { useForm, UseFormRegisterReturn } from 'react-hook-form'
import { FiFile } from 'react-icons/fi'
type FileUploadProps = {
register: UseFormRegisterReturn
accept?: string
multiple?: boolean
children?: ReactNode
View apollo_client.ts
import ApolloClient, { FetchPolicy } from "apollo-client"
import { HttpLink } from "apollo-link-http"
import { InMemoryCache, NormalizedCacheObject } from "apollo-cache-inmemory"
// import { setContext } from "apollo-link-context"
import ActionCable from "action-cable-react-jwt"
import ActionCableLink from "graphql-ruby-client/dist/subscriptions/ActionCableLink"
import { ApolloLink } from "apollo-link"
import { handleAuthentication, refreshToken } from "utils/oauth"
import { Observable } from "apollo-link"
import { onError } from "apollo-link-error"
marlosirapuan / Dokku v0.5.6 Rails
Created Jul 30, 2020 — forked from Epigene/Dokku v0.5.6 Rails
Knowledge-Base for getting a Rails5 app with Cable running on dokku v0.5.6
View Dokku v0.5.6 Rails

Dokku v0.5.6 Rails workflow

Straight to Maintenance

0. Set up Droplet

Initialize the droplet with dokku app pre-setup
marlosirapuan / Input.tsx
Created Jul 9, 2020
React custom Input
View Input.tsx
import React, {
} from 'react'
marlosirapuan / launch.json
Last active Apr 17, 2020
Simple initial setup with Node, Typescript, Yarn and Vscode
View launch.json
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit:
"version": "0.2.0",
"configurations": [
"type": "node",
"request": "attach",
"protocol": "inspector",
View gist:778d6beda5f8ab95695748011c864b19

Install ffmpeg

brew install ffmpeg

Download file through url, like this:

ffmpeg -protocol_whitelist file,http,https,tcp,tls,crypto -i "http://url-file.domain.m3u8" -c copy video.mp4
marlosirapuan /
Created Oct 12, 2019
Tiny script to backup and restore database with Docker
#!/usr/bin/env bash
echo "BACKUPING..."
docker run -i -e PGPASSWORD=<password> --rm postgres /usr/bin/pg_dump -p <port> -h <ip> -U <user> <db> | gzip -9 > backup.sql.gz
echo "BACKUPING...[END]"
if [ -n "$1" ] ; then
where="where pg_stat_activity.datname = '<db>' AND pid <> pg_backend_pid();"
cat <<-EOF | docker exec -i <container_db_local> psql -h -U <user_db> -d postgres
marlosirapuan / example_activejob.rb
Created Oct 5, 2019 — forked from ChuckJHardy/example_activejob.rb
Example ActiveJob with RSpec Tests
View example_activejob.rb
class MyJob < ActiveJob::Base
queue_as :urgent
rescue_from(NoResultsError) do
retry_job wait: 5.minutes, queue: :default
def perform(*args)*args)