Skip to content

Instantly share code, notes, and snippets.

View jermainee's full-sized avatar

Jermaine Jonas Ernst jermainee

View GitHub Profile
@jermainee
jermainee / emoji_favicon.html
Created August 2, 2023 19:33
Use an emoji as favicon in html websites
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='1em' font-size='100'>📝</text></svg>">
@jermainee
jermainee / install-instapy.sh
Created February 15, 2022 22:45
Script which installs InstaPy on an Ubuntu server
#!/bin/bash
apt-get update
apt-get -y upgrade
apt-get -y install unzip python3-pip python3-dev build-essential libssl-dev libffi-dev xvfb
pip3 install --upgrade pip
export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
locale-gen en_US.UTF-8
@jermainee
jermainee / z_additional.cnf
Created June 10, 2021 15:23
MySQL tweaks - /etc/mysql/conf.d/z_additional.cnf
[mysqld]
skip-log-bin
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
skip-character-set-client-handshake
# innodb_buffer_pool_size should be about 70% of the ram on db-only servers
innodb_buffer_pool_size = 16G
max_allowed_packet = 1G
@jermainee
jermainee / resize.txt
Last active June 10, 2021 15:14
Fix wrong disk size after server upgrade - runcloud.io
root@xxx:~# df -Th
Filesystem Type Size Used Avail Use% Mounted on
udev devtmpfs 16G 0 16G 0% /dev
tmpfs tmpfs 3.2G 7.8M 3.2G 1% /run
/dev/sda3 ext4 137G 36G 96G 28% /
tmpfs tmpfs 16G 0 16G 0% /dev/shm
tmpfs tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs tmpfs 16G 0 16G 0% /sys/fs/cgroup
/dev/sda2 ext4 976M 218M 692M 24% /boot
tmpfs tmpfs 3.2G 0 3.2G 0% /run/user/1001
@jermainee
jermainee / copy.html
Last active March 10, 2019 09:26
Copy URL from Input
<input type="url" id="copyLinkInput" value="example.com" />
<button id="copyLinkTrigger">Copy link</button>
<script>
const copyLinkTrigger = document.getElementById("copyLinkTrigger");
const linkInputElement = document.getElementById("copyLinkInput");
copyLinkTrigger.addEventListener("click", event => {
event.srcElement.textContent = "Copied!";
linkInputElement.select();
@jermainee
jermainee / bundle.php
Last active September 23, 2018 08:11
Quick and dirty cli script to bundle JavaScript files
<?php
$dir = './js/';
// Bundle the JavaScript files in the right order
$files = [
'jquery.min.js',
'jquery.scrollzer.min.js',
'jquery.scrolly.min.js',
'util.js',
@jermainee
jermainee / example.conf
Created September 8, 2018 12:11
Simple NGINX configuration for static websites with HTTPS
server {
listen 80;
listen 443 ssl;
server_name example.com *.example.com;
error_log /var/log/nginx/example-com.error.log error;
if ($scheme != "https") {
return 301 https://$server_name$request_uri;
}
@jermainee
jermainee / tls.conf
Created September 8, 2018 12:05
Let's Encrypt HTTPS configuration on NGINX
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_dhparam /etc/ssl/certs/dhparam2048.pem;
ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDS$
ssl_session_timeout 1d;
ssl_session_cache shared:SSL:50m;
ssl_session_tickets off;
ssl_stapling on;
@jermainee
jermainee / caching.conf
Last active June 10, 2021 15:13
Caching static files on NGINX
location ~*\.(jpg|jpeg|png|gif|ico|css|js|webp)$ {
add_header Cache-Control "public";
expires 365d;
log_not_found off;
access_log off;
}
location ~*\.(pdf)$ {
add_header Cache-Control "public";
expires 30d;