Skip to content

Instantly share code, notes, and snippets.

View marlluslustosa's full-sized avatar

Marllus Lustosa marlluslustosa

View GitHub Profile
@marlluslustosa
marlluslustosa / post.html
Last active June 23, 2021 15:29
frontend - gitalk anon
<link rel="stylesheet" href="/assets/js/gitalk/v1.6.8/gitalk.css">
<script src="/assets/js/gitalk/v1.6.8/gitalk.min.js"></script>
<div id="js-gitalk-container"></div><script>
var locationArr = window.location.pathname.split('/')
var gitalk = new Gitalk({
clientID: '',
clientSecret: '',
repo: 'gitalk_comments',
@marlluslustosa
marlluslustosa / config.js
Last active June 23, 2021 15:18
Config.js gitalk anon
//example values
module.exports = {
appId: '3b576084h403303u32', //https://github.com/settings/developers - CliendID
appSecret: '403303u3294746895468957942rfasdfhdasfads21032131', //https://github.com/settings/developers - ClientSecret
origin: 'https://e44ff76c.myblog-bkz.pages.dev', //your domain or * for any domains origin
accessToken: 'jdsaofdhsfhsdaifbsdjafb38482914312nd', //https://github.com/settings/tokens
state: 'random string',
redirectURI: 'https://gitalk-anonmously-comment-kappa.vercel.app/api/access_token' //vercel domain
}
@marlluslustosa
marlluslustosa / ranking_featured.yml
Last active May 31, 2021 15:52
Ranking featured posts
@marlluslustosa
marlluslustosa / edit_ranking.sh
Created May 30, 2021 20:50
edit ranking script - marllus.com
#!/bin/bash
#marllus.com
cat export.txt | cut -d',' -f1 | sort | uniq -c | sort -r | egrep '\ \/(tecnologia|poesia|sociedade|arte)' | head -4 | sed 's/^\ *//g' | cut -d' ' -f2 | sed 's/^\/.*\///g ; s/\.html//g' > ranking_posts
cat export.txt | cut -d',' -f1,2 | sort | uniq -c | sort -r | egrep '\ \/(tecnologia|poesia|sociedade|arte)' | head -4 | sed 's/^\ .//g' | cut -d',' -f1,2 | sed 's/^\ *\([0-9]\+\)\ *.*html,\(.*$\)/- \2 (\1 views)/g' > ranking_posts_name
sed -i '1 i\Há uma mudança nos artigos em destaque. Segue a lista dos mais vistos:' ranking_posts_name
#remove previous featured in posts
find _posts/ -name "*.md" | xargs -n 1 sed -i '/^featured:\ true/d ; /^hidden:\ true/d ; /^rating:\ [1-5]\{1\}/d'
@marlluslustosa
marlluslustosa / export_goat.sh
Created May 30, 2021 20:45
Export report goatcounter
#!/bin/bash
# https://www.goatcounter.com/code/api#export-64
token=$1
api=$2
curl() {
\command curl \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $token" \
"$@"
@marlluslustosa
marlluslustosa / watchtower.sh
Last active November 10, 2020 12:02
watchtower.yml
docker run -d \
--name watchtower \
-v /var/run/docker.sock:/var/run/docker.sock \
-e WATCHTOWER_NOTIFICATIONS=email \
-e WATCHTOWER_NOTIFICATION_EMAIL_FROM=fromaddresssengrid@example.com \
-e WATCHTOWER_NOTIFICATION_EMAIL_TO=toaddress@example.com \
-e WATCHTOWER_NOTIFICATION_EMAIL_SERVER=smtp.sendgrid.net \
-e WATCHTOWER_NOTIFICATION_EMAIL_SERVER_PORT=587 \
-e WATCHTOWER_NOTIFICATION_EMAIL_SERVER_USER=apikey \
-e WATCHTOWER_NOTIFICATION_EMAIL_SERVER_PASSWORD=tokensendgrid \
@marlluslustosa
marlluslustosa / workflow_build_push.yml
Last active October 14, 2020 23:37
DevOps Workflow - build/push
name: Workflow - sendgrid pull push
on:
push:
branches:
- master
pull_request:
env:
# Variavel de ambiente vista para qualquer job
name: Workflow - scan agendado
on:
schedule:
# toda segunda-feira às 5 horas da matina!
- cron: '0 5 * * 1'
env:
# Variavel de ambiente vista para qualquer job
# nome da imagem - altere para o nome correto
@marlluslustosa
marlluslustosa / workflowbuild_push.yaml
Created October 13, 2020 04:36
workflow - build/push
name: Workflow - build/push
on:
push:
branches:
- master
pull_request:
env:
# Variavel de ambiente vista para qualquer job
@marlluslustosa
marlluslustosa / .bash_profile
Created July 11, 2020 13:33 — forked from jonsuh/.bash_profile
Bash echo in color
# ----------------------------------
# Colors
# ----------------------------------
NOCOLOR='\033[0m'
RED='\033[0;31m'
GREEN='\033[0;32m'
ORANGE='\033[0;33m'
BLUE='\033[0;34m'
PURPLE='\033[0;35m'
CYAN='\033[0;36m'