Skip to content

Instantly share code, notes, and snippets.

View josectheone's full-sized avatar

Jose Carlos josectheone

View GitHub Profile
@josectheone
josectheone / make-chr.sh
Created November 25, 2021 15:06 — forked from hklkf/make-chr.sh
Install Mikrotik CHR on a Digital Ocean droplet
wget http://download2.mikrotik.com/routeros/6.40.5/chr-6.40.5.img.zip -O chr.img.zip && \
gunzip -c chr.img.zip > chr.img && \
apt-get update && \
apt install -y qemu-utils pv && \
qemu-img convert chr.img -O qcow2 chr.qcow2 && \
qemu-img resize chr.qcow2 `fdisk /dev/vda -l | head -n 1 | cut -d',' -f 2 | cut -d' ' -f 2` && \
modprobe nbd && \
qemu-nbd -c /dev/nbd0 chr.qcow2 && \
echo "Give some time for qemu-nbd to be ready" && \
sleep 2 && \
@josectheone
josectheone / README.md
Created March 12, 2021 15:22 — forked from zoilomora/README.md
How to disable cloud-init in Ubuntu

How to disable cloud-init in Ubuntu

Prevent start

  • Create an empty file to prevent the service from starting

      sudo touch /etc/cloud/cloud-init.disabled
    

Uninstall

Installing mailx

yum -y update
yum install -y mailx

We can now start sending e-mails using

@josectheone
josectheone / toggle_swap.sh
Created January 22, 2021 16:59 — forked from Jekis/toggle_swap.sh
Empty swap. Clear swap. Move swap to RAM. Ubuntu.
#!/bin/bash
function echo_mem_stat () {
mem_total="$(free | grep 'Mem:' | awk '{print $2}')"
free_mem="$(free | grep 'Mem:' | awk '{print $7}')"
mem_percentage=$(($free_mem * 100 / $mem_total))
swap_total="$(free | grep 'Swap:' | awk '{print $2}')"
used_swap="$(free | grep 'Swap:' | awk '{print $3}')"
swap_percentage=$(($used_swap * 100 / $swap_total))
@josectheone
josectheone / .xprofile
Created January 3, 2020 12:41
Custom resolutions in linux
#!/bin/sh
# shows aoutput device
# xrandr | grep -e " connected [^(]" | sed -e "s/\([A-Z0-9]\+\) connected.*/\1/"
# to output desired resolutuion parameteres
# cvt 1920 1080 60
# set desired resolution parameters
xrandr --newmode "1920x1080_60.00" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync
@josectheone
josectheone / pldt-home-fibr-an5506-04-fa-rp2627-advanced-settings.md
Created November 4, 2019 22:51 — forked from kleo/backspace.md
PLDT HOME FIBR AN5506-04-FA RP2627 Advanced Settings

PLDT HOME FIBR AN5506-04-FA RP2627 Advanced Settings


[Notice]

Project moved to https://gitlab.com/kbeflo/fiberhomesuperadmin due to excessive amount of unicorns.
Gist here will not be updated anymore
Discussion here on Gist is still allowed but I strongly recommend going over to Gitlab or Discord chat

@josectheone
josectheone / docker-compose.yml
Last active October 16, 2019 17:15
PostgreSQL + pgAdmin 4
version: '3'
services:
postgres:
container_name: postgresql
image: postgres:10
restart: always
environment:
POSTGRES_PASSWORD: "password"
ports:
@josectheone
josectheone / Dockerfile
Last active October 19, 2019 23:29
Dockerfile - Golang com base Alpine
FROM golang:alpine AS builder
RUN apk update && apk add --no-cache git ca-certificates tzdata && update-ca-certificates
RUN adduser -D -g '' appuser
ENV GO111MODULE=on
WORKDIR /app
@josectheone
josectheone / jail.local
Created October 14, 2019 11:49
Fail2ban conf file
[sshd]
enabled = true
[INCLUDES]
before = paths-fedora.conf
[DEFAULT]
ignorecommand =
bantime = 60m
@josectheone
josectheone / how_to.txt
Created October 14, 2019 11:35
Docker and UFW solution
1 - Add this lines to the end of /etc/ufw/after.rules
# BEGIN UFW AND DOCKER
*filter
:ufw-user-forward - [0:0]
:DOCKER-USER - [0:0]
-A DOCKER-USER -j RETURN -s 10.0.0.0/8
-A DOCKER-USER -j RETURN -s 172.16.0.0/12
-A DOCKER-USER -j RETURN -s 192.168.0.0/16