Skip to content

Instantly share code, notes, and snippets.

View DennisLoska's full-sized avatar

Dennis Loska DennisLoska

View GitHub Profile
@DennisLoska
DennisLoska / webp_optimizer.rs
Last active July 24, 2023 20:53
A very basic webp image optimizer written to learn Rust using the cwebp encoder.
use std::fs::{self, DirEntry};
use std::path::Path;
use std::process::Command;
fn optimize_img(path: &DirEntry, root_path: &Path) {
let path_binding = path.path();
let root_str = root_path.to_str().expect("Path should exist.");
let name_binding = path.file_name();
let path_name = path_binding.to_str().expect("Filename should exist.");
let current_data = name_binding.to_str().expect("Current path should exist.");
@DennisLoska
DennisLoska / asymmetric_encryption.js
Created September 8, 2021 12:53
Asymmetric encryption of JSON in node.js
const NodeRSA = require('node-rsa');
// generate new public/private key-pair
const key = new NodeRSA({ b: 2048 });
const publicKey = key.exportKey('pkcs8-public-pem');
const privateKey = key.exportKey('pkcs8-private-pem');
// print the keys
console.log('\nPUBLIC KEY:\n');
console.log(publicKey);
version: '3'
services:
netdata:
image: netdata/netdata
container_name: netdata
hostname: example.com # set to fqdn of host
ports:
- 91:19999
restart: unless-stopped
cap_add:
@DennisLoska
DennisLoska / docker-compose.yml
Created November 10, 2020 19:10
Nginx Proxy Manager for RPI4
version: "3"
services:
app:
image: jc21/nginx-proxy-manager:2
restart: always
ports:
# Public HTTP Port:
- '80:80'
# Public HTTPS Port:
- '443:443'
version: '3'
volumes:
nextcloud:
db:
services:
db:
image: mariadb
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
@DennisLoska
DennisLoska / docker-compose.yml
Created November 2, 2020 20:57
Pihole configuration for Raspberry Pi 4
version: "3"
# More info at https://github.com/pi-hole/docker-pi-hole/ and https://docs.pi-hole.net/
services:
pihole:
container_name: pihole
image: pihole/pihole:latest
ports:
- "53:53/tcp"
- "53:53/udp"
@DennisLoska
DennisLoska / config.json
Last active November 3, 2020 21:28
working combination - nginx proxy-manager config - nginxproxymanager.com for Raspberry Pi 4
{
"database": {
"engine": "mysql",
"host": "db",
"name": "npm",
"user": "npm",
"password": "npm",
"port": 3306
}
}
@DennisLoska
DennisLoska / .bash_aliases
Last active December 31, 2019 20:14
Some handy aliases for your bashrc/bash_aliases file.
# Verbosity and settings that you pretty much just always are going to want.
alias \
cp="cp -iv" \
mv="mv -iv" \
rm="rm -v" \
mkd="mkdir -pv" \
r="ranger" \
c="clear" \
yt="youtube-dl --add-metadata -i" \
yta="yt -x -f bestaudio/best" \