Skip to content

Instantly share code, notes, and snippets.

Avatar

Marllus Lustosa marlluslustosa

View GitHub Profile
@marlluslustosa
marlluslustosa / post.html
Last active Jun 23, 2021
frontend - gitalk anon
View post.html
<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 Jun 23, 2021
Config.js gitalk anon
View config.js
//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
Ranking featured posts
View ranking_featured.yml
@marlluslustosa
marlluslustosa / edit_ranking.sh
Created May 30, 2021
edit ranking script - marllus.com
View edit_ranking.sh
#!/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
Export report goatcounter
View export_goat.sh
#!/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" \
"$@"
View watchtower.sh
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 Oct 14, 2020
DevOps Workflow - build/push
View workflow_build_push.yml
name: Workflow - sendgrid pull push
on:
push:
branches:
- master
pull_request:
env:
# Variavel de ambiente vista para qualquer job
View workflowscan-agendado.yaml
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
View workflowbuild_push.yaml
name: Workflow - build/push
on:
push:
branches:
- master
pull_request:
env:
# Variavel de ambiente vista para qualquer job
@marlluslustosa
marlluslustosa / .bash_profile
Created Jul 11, 2020 — forked from jonsuh/.bash_profile
Bash echo in color
View .bash_profile
# ----------------------------------
# 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'