Skip to content

Instantly share code, notes, and snippets.

View Denperidge's full-sized avatar

Cat Denperidge

View GitHub Profile
@Denperidge
Denperidge / DotConfig.md
Created October 3, 2022 22:51
A writeup of how I store and update my config files!

Dotconfig

The method with which I securely and easily keep track of my local config files.

The basic workflow consists of creating a private (GitHub) Repo with the following structure

  • {SERVERNAME}.{CONFIGFILENAME}: for example, raspberrypi.docker-compose.yml. These can be as many as you want.
  • {SERVERNAME}.config.sh: a script that clones or pulls the repo, and creates symbolic links for the necessary files. The code for this will be shown below.

From there, you can simply run the X.config.sh files using a cronjob, systemd, or just manually.

yt-dlp {url} -S "height:720,+size"
@Denperidge
Denperidge / ImportContacts.gs
Last active July 19, 2022 20:40
Import contacts into a spreadsheet, if they have a label starting with {string}
/**
* Import contacts with defined label, add them between colStart and colEnd, without adding ones that were previously added
*/
function main() {
already_added = importContacts("Starred");
importContacts("[0]", "F", "H", already_added);
}
function importContacts(groupname, colStart="A", colEnd="C", filter_out=[], maxMembers=50) {
@Denperidge
Denperidge / @README
Last active November 21, 2022 12:03
Setup a Terraria server on Raspbian with one shell script!
Archived!
This has been moved to a dedicated repo: https://github.com/denperidge/terraria-raspbian-server
------------------------------------------
------------------------------------------
@Denperidge
Denperidge / $ nextcloud-postgres-docker.md
Last active August 14, 2021 15:14
Raspberry Pi Nextcloud-Docker

Raspberry Pi Nextcloud-Docker

  • MySQL/MariaDB doesn't have an armhf docker image by default, hence postgresql is used instead
  • For some reason, the postgres env variables don't seem to work. If that's the case, use nextcloud for for DB and USER, and localhost:5432 for HOST
  • I used Caddy for HTTPS encryption
  • NEXTCLOUD_DATA_DIR=/var/www/html/data fixes a config write issue. The fix was found on this SO post!
@Denperidge
Denperidge / gulpfile.js
Last active June 19, 2021 10:33
A Gulpfile for Pug/Sass/Babel development: Pug+Sass+Autoprefixer+Babel+UglifyJS+BrowserSync
// Run the following two npm installs to get all the requirements set up
// npm install --global gulp-cli
// npm install --save-dev gulp gulp-pug node-sass gulp-sass gulp-autoprefixer gulp-babel @babel/core @babel/preset-env gulp-uglify browser-sync gulp-plumber
// You can configure the following variables to your liking
var sourceDir = 'src/';
var destDir = 'docs/';
var pugGlob = `${sourceDir}**.pug`;
var sassGlob = [`${sourceDir}**.scss`, `!${sourceDir}/**/vendor/**`];
var jsGlob = [`${sourceDir}**/*.js`, `!${sourceDir}/**/vendor/**`];
@Denperidge
Denperidge / randomize.js
Last active May 6, 2021 20:28
Randomizer for your website. I don't recommend using this.
<script>
function rng(min, max) {
// Inclusive rng function from W3Schools https://www.w3schools.com/js/js_random.asp
return Math.floor(Math.random() * (max - min + 1) ) + min;
}
var destructibleTextElements =
jQuery("span,p,h2,h4,h5,a,label")
.filter(function() {
// Visibility check through offsetparent from from https://stackoverflow.com/a/21696585
@Denperidge
Denperidge / quick-multiple-ssh-key-setup.py
Last active April 10, 2021 23:24
Quickly configure ssh key access to multiple servers!
from os import chdir, path, name
from subprocess import run
"""
If you're like me and postponed setting up ssh keys for way too long
and now you have a bunch of servers to do it with, here you go!
Credit where credit is due!
SSH setup tutorial: https://www.digitalocean.com/community/tutorials/how-to-set-up-ssh-keys-2
@Denperidge
Denperidge / caddy-linux-service.sh
Last active February 28, 2024 10:49
A simple bash script that installs caddy as a service on your Linux system, merely automating the official steps described here https://caddyserver.com/docs/install#linux-service
#!/bin/bash
echo "Enter your download url that you made from here: https://caddyserver.com/download"
read downloadurl
curl --output caddy $downloadurl
chmod +x caddy
sudo mv caddy /usr/bin