Skip to content

Instantly share code, notes, and snippets.

Lucas Borges borgeslucaz

View GitHub Profile
View Ubuntu reduce TIME_WAIT and set socket recycle and reuse
sudo vi /etc/sysctl.conf
# Add the following to sysctl.conf:
# Decrease TIME_WAIT seconds
net.ipv4.tcp_fin_timeout = 30
# Recycle and Reuse TIME_WAIT sockets faster
net.ipv4.tcp_tw_recycle = 1
View deploy.sh
#!/bin/sh
APP_URL="abcdef.com.br"
ROOT_PATH="/srv/${APP_URL}/www/"
RELEASES="${ROOT_PATH}/releases"
CURRENT="${ROOT_PATH}/current"
GIT_URL="https://github.com/borgeslucaz/modern-go-application.git"
NEW_RELEASE=$(date +%s)
NEW_RELEASE_PATH="${ROOT_PATH}/releases/${NEW_RELEASE}"
View deploy.sh
#!/bin/sh
APP_URL="abcdef.com.br"
ROOT_PATH="/srv/${APP_URL}/www/"
RELEASES="${ROOT_PATH}/releases"
CURRENT="${ROOT_PATH}/current"
GIT="https://github.com/borgeslucaz/modern-go-application.git"
NEW_RELEASE=$(date +%s)
# Create new release
View gist:70d783594a5d85214e8998e997e8c739
#!/bin/bash
NOBLANK="
@xset s noblank
@xset s off
@xset -dpms
"
# Pretty ANSI text colors
OFF="\033[0m"
View yt.py
import urllib
import json
import requests
def download_img(url, filename):
response = requests.get(url)
filename = filename.replace('/', '')
if response.status_code == 200:
with open(F"/srv/nightwing.cloudezapp.io/www/sara_thumbs/{filename}.jpg", 'wb') as f:
f.write(response.content)
View watcher.go
package watcher
import (
"git.cloudez.io/stan/config"
"git.cloudez.io/stan/database"
"fmt"
"net/http"
"time"
"os"
You can’t perform that action at this time.