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 / nginx-location.md
Created November 17, 2023 01:50
Nginx Location block Tutorial

Nginx location:

Nginx location block section have a search order, a modifier, an implicit match type and an implicit switch to whether stop the search on match or not. the following array describe it for regex.


# --------------------------------------------------------------------------------------------------------------------------------------------
# Search-Order       Modifier       Description                                                        Match-Type        Stops-search-on-match
# --------------------------------------------------------------------------------------------------------------------------------------------
#     1st               =           The URI must match the specified pattern exactly                  Simple-string              Yes
@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 / file-permission-wordpress.md
Created May 10, 2023 06:13
File permission wordpress and Hardening it

When you setup WP you (the webserver) may need write access to the files. So the access rights may need to be loose.

chown www-data:www-data  -R * # Let Apache be owner
find . -type d -exec chmod 755 {} \;  # Change directory permissions rwxr-xr-x
find . -type f -exec chmod 644 {} \;  # Change file permissions rw-r--r--

After the setup you should tighten the access rights, according to Hardening WordPress all files except for wp-content should be writable by your user account only. wp-content must be writable by www-data too.

@ebta
ebta / etc-issue.md
Created February 21, 2023 08:02
Linux display or change a pre-login message /etc/issue file

The /etc/issue file escape code

The issue-file (/etc/issue or the file set with the -f option) may contain certain escape codes to display the system name, date and time etc. All escape codes consist of a backslash () immediately followed by one of the letters explained below.

\b : Insert the baudrate of the current line.
\d : Insert the current date.
\s : Insert the system name, the name of the operating system.
\l : Insert the name of the current tty line.

@ebta
ebta / mime-types.md
Created February 19, 2023 15:11
Common MIME types

Source : Common MIME types

This topic lists most common MIME types, with corresponding document types, ordered by their common extensions.

Two primary MIME types are important for the role of default types:

  • text/plain is the default value for textual files. A textual file should be human-readable and must not contain binary data.
  • application/octet-stream is the default value for all other cases. An unknown file type should use this type. Browsers pay a particular care when manipulating these files, to protect users from software vulnerabilities and possible dangerous behavior.

IANA is the official registry of MIME media types and maintains a list of all the official MIME types. This table lists important MIME types for the Web:

@ebta
ebta / regexp-password.md
Last active August 30, 2022 09:34
Regexp Password Validation

Minimum eight characters, at least one letter and one number:

^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{8,}$

Minimum eight characters, at least one letter, one number and one special character:

^(?=.*[A-Za-z])(?=.*\d)(?=.*[@$!%*#?&])[A-Za-z\d@$!%*#?&]{8,}$
@ebta
ebta / download-gdrive-wget-terminal.md
Last active May 26, 2022 12:43
Download file from Google Drive in Terminal sign wget

Example the link to be downloaded is

https://drive.google.com/file/d/Ncg6Sw4c00j1mhVl8y7oMTIZ3xkOPlV5G/view

Copy FILEID, from URL above the FILEID is : Ncg6Sw4c00j1mhVl8y7oMTIZ3xkOPlV5G If the file is not big, ex less than 25MB (download without confirmation), use this command (replace FILEID with your ID download):

wget --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O filename.out

If the file is big (with confirmation download), ex. more than 25 MB, using this command (watch for FILEID)

@ebta
ebta / change timezone.md
Last active April 14, 2022 03:28
Mengubah timezone di Ubuntu 20.04

Check current timezone

date 
timedatectl

Option 1 – Using timedatectl

Using timedatectl, check first available timezones

timedatectl list-timezones