Skip to content

Instantly share code, notes, and snippets.

View ebta's full-sized avatar

Ebta Setiawan ebta

View GitHub Profile
@ebta
ebta / server.conf
Created March 26, 2021 04:43 — forked from laurenorsini/server.conf
OpenVPN configuration for /etc/openvpn/server.conf
local 192.168.2.0 # SWAP THIS NUMBER WITH YOUR RASPBERRY PI IP ADDRESS
dev tun
proto udp #Some people prefer to use tcp. Don't change it if you don't know.
port 1194
ca /etc/openvpn/easy-rsa/keys/ca.crt
cert /etc/openvpn/easy-rsa/keys/Server.crt # SWAP WITH YOUR CRT NAME
key /etc/openvpn/easy-rsa/keys/Server.key # SWAP WITH YOUR KEY NAME
dh /etc/openvpn/easy-rsa/keys/dh1024.pem # If you changed to 2048, change that here!
server 10.8.0.0 255.255.255.0
# server and remote endpoints
@ebta
ebta / image magick.md
Created March 22, 2021 08:37
image magick tips slice combine images

Berikut beberapa tips

Slice image menjadi 3-3 ukuran sama

.\magick.exe convert .\test-rect.jpg -crop 3x3@ +repage +adjoin tile-%d.jpg

Gabungkan beberapa images diatas menjadi satu

.\magick.exe montage -mode concatenate -tile 3x -frame 3 tile-*.jpg out.jpg
@ebta
ebta / terminal-tips.md
Last active March 12, 2023 11:51
Linux Terminal Command Tips

List how much RAM consumed by each process

ps -eo rss,pid,user,command --sort -size | \
awk '{ hr=$1/1024 ; printf("%13.2f Mb ",hr) } { for ( x=4 ; x<=NF ; x++ ) { printf("%s ",$x) } print "" }' | \
egrep -v 0.00

One line

ps -eo rss,pid,user,command --sort -size | awk '{ hr=$1/1024 ; printf("%13.2f Mb ",hr) } { for ( x=4 ; x<=NF ; x++ ) { printf("%s ",$x) } print "" }' | egrep -v 0.00
@ebta
ebta / embedded-file-viewer.md
Last active March 26, 2024 06:43 — forked from tzmartin/embedded-file-viewer.md
Embedded File Viewer: Google Drive, OneDrive

Office Web Apps Viewer

('.ppt' '.pptx' '.doc', '.docx', '.xls', '.xlsx')

http://view.officeapps.live.com/op/view.aspx?src=[OFFICE_FILE_URL]

<iframe src='https://view.officeapps.live.com/op/embed.aspx?src=[OFFICE_FILE_URL]' width='px' height='px' frameborder='0'>
</iframe>

OneDrive Embed Links

Create a Software RAID 1 setup for your 2-disk server on Ubuntu Server 20.04

Let's start with the basics: the official guide by Ubuntu (https://ubuntu.com/server/docs/installation-advanced) is outdated/wrong.

Now on to the solution:

  • Select "Custom storage layout" when you reach the storage step of the installer
  • If the disks have existing partitions, click on each disk under AVAILABLE DEVICES and then select REFORMAT. This will (temporarily) wipe out the partitions.
  • Now select the 1st disk to add as "boot" disk (same menu that had REFORMAT in).
  • Do the same with the 2nd disk.
@ebta
ebta / fossil-as-a-service.md
Last active August 1, 2022 02:19
Create Fossil (run as) Service in Linux using systemd

Agar fossil bisa berjalan sebagai service di Ubuntu, buat di systemd.

Simpan berikut (mulai dari [Unit]), misal: /etc/systemd/system/fossil.service. Sesuaikan isi bagian User (userssh) dan port (12345) server listening

[Unit]
Description=fossil version control service daemon
# After=multi-user.target
# Wants=
@ebta
ebta / fossil-nginx.conf
Last active September 28, 2023 14:36
Run Fossil Server in Linux using NGINX as SCGI
# Jalankan service fossil dengan syntax berikut (sesuaikan port)
# /usr/local/bin/fossil server --port 12345 --scgi /dir/location/data/repo
# Atau dibuat service agar bisa otomatis startup melalui script berikut :
# https://gist.github.com/ebta/1c30036d477289d7d33f847497566390
server {
server_name therepo.domain.com;
root /usr/local/bin/fossil;
location / {
scgi_param REQUEST_METHOD $request_method;
@ebta
ebta / nginx-stop.bat
Created January 13, 2021 13:32
Stop Running Nginx in Windows
@echo off
cd /D %~dp0
if not exist logs\nginx.pid GOTO skip
nginx.exe -s quit
del logs\nginx.pid
:skip
@ebta
ebta / mariadb-portable.md
Last active January 10, 2021 14:24
Install Minimalist Portable MariaDB 10.4 in Windows 10

General Step (MariaDB Up to 10.4)

Speaking of MariaDB, it is 2 files and 3 directories.

Layout is like this:

  1. bin\mysqld.exe
  2. share\english\errmsg.sys # you can take it from share\english in normal installation or ZIP
  3. data # an empty directory you can start with
bin\mysqld.exe --console --skip-grant-tables 
@ebta
ebta / mysqldump-cron.sh
Last active August 21, 2024 05:19
Backup MySQL Database Daily, Weekly and Monthly
#!/bin/bash
# Modified from: https://grahamrpugh.com/2019/01/15/mysqldump-daily-weekly-monthly.html
# Create database user with these privileges:
# SELECT, RELOAD, SHOW DATABASES, LOCK TABLES, TRIGGER, SHOW VIEW
#
# CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
# GRANT SELECT, RELOAD, SHOW DATABASES, LOCK TABLES, TRIGGER, SHOW VIEW ON *.* TO 'newuser'@'localhost';
# FLUSH PRIVILEGES;