Skip to content

Instantly share code, notes, and snippets.

View ebta's full-sized avatar

Ebta Setiawan ebta

View GitHub Profile
@ebta
ebta / clean.sh
Created May 19, 2024 14:03 — forked from Iman/clean.sh
Free up disk space on Ubuntu - clean log, cache, archive packages/apt archives, orphaned packages, old kernel and remove the trash
#!/bin/sh
#Check the Drive Space Used by Cached Files
du -sh /var/cache/apt/archives
#Clean all the log file
#for logs in `find /var/log -type f`; do > $logs; done
logs=`find /var/log -type f`
for i in $logs
@ebta
ebta / Converting MS Office files to PDF.md
Last active September 13, 2023 01:44 — forked from mbohun/NOTES.md
Converting MS Office files to PDF

Converting MS Office files to PDF

(Description of the different solutions / alternatives)

1. Microsoft Windows based solutions

1.1 Microsoft Graph API (Office 365)

This is the current, official, Microsoft endorsed/supported solution ("cloud based")
(2017 - present)

  1. The user uploads their MS Office document (source.doc in our example snippet bellow) to their Microsoft OneDrive
  2. The user then uses the Microsoft Graph REST API to send a HTTP GET Request to the Convert content endpoint:
@ebta
ebta / php-fpm-pools-optimize.md
Last active March 3, 2023 03:31 — forked from holmberd/php-pools.md
Adjusting (Optimizing) child processes for php fpm pools (Nginx) - PHP 7.4

Adjusting child processes for PHP-FPM (Nginx)

When setting these options consider the following:

  • How long is your average request?
  • What is the maximum number of simultaneous visitors the site(s) get?
  • How much memory on average does each child process consume?

Determine if the max_children limit has been reached.

  • sudo grep max_children /var/log/php?.?-fpm.log.1 /var/log/php?.?-fpm.log
@ebta
ebta / codeiginter-server-config.md
Created June 15, 2021 02:33 — forked from yidas/codeiginter-server-config.md
Codeigniter 3 server configuration for Nginx & Apache

Codeigniter 3 server configuration for Nginx & Apache

Web Server Site Configuration

Recommended Apache Configuration

Use the following configuration in Apache's httpd.conf file or within a virtual host configuration. Note that you should set DocumentRoot and ServerName fit to your environment:

@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 / 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 / grayscale.md
Last active November 22, 2020 14:45 — forked from anderflash/grayscale.sh
Convert PDF to Grayscale using ghostscript

Install ghostscript from yout terminal : sudo apt install ghostscript, then create file, for example pdf2gray.sh and copy paste the script bellow. Add execution access using chmod +x pdf2gray.sh

#!/bin/bash

gs \
 -sOutputFile=$2 \
 -sDEVICE=pdfwrite \
 -sColorConversionStrategy=Gray \
 -dProcessColorModel=/DeviceGray \
 -dCompatibilityLevel=1.4 \