Skip to content

Instantly share code, notes, and snippets.

View jpcaparas's full-sized avatar
🐔

Jayps jpcaparas

🐔
View GitHub Profile
@jpcaparas
jpcaparas / [email protected]
Created May 31, 2019 03:29
OpenVPN client Fedora systemd service
[Unit]
Description=OpenVPN tunnel for %I
After=syslog.target network-online.target
Wants=network-online.target
Documentation=man:openvpn(8)
Documentation=https://community.openvpn.net/openvpn/wiki/Openvpn24ManPage
Documentation=https://community.openvpn.net/openvpn/wiki/HOWTO
[Service]
Type=notify
@jpcaparas
jpcaparas / rclone-to-gdrive.sh
Last active June 3, 2019 02:08
Tarball to standard output and then to rclone (rclone-to-gdrive.sh)
#!/bin/bash
# file: rclone-to-gdrive.sh
# usage: $(rclone-to-gdrive.sh /var/www /etc/nginx /var/some\ dir\ with\ spaces)
set -e
# Check if user running the script is root
# https://askubuntu.com/questions/15853/how-can-a-script-check-if-its-being-run-as-root
if [[ $EUID -ne 0 ]]; then
@jpcaparas
jpcaparas / prompt.sh
Created June 9, 2019 00:22
BASH: Variable substitution on user input
#!/bin/bash
set -e
name=
_prompt() {
local message="$1"
local -n input="$2"
@jpcaparas
jpcaparas / selenium
Created June 21, 2019 04:14
Selenium Standalone Server wrapper
# usr/local/bin/selenium
#!/usr/bin/env bash
set -e
# Download from https://www.seleniumhq.org/download/
SELENIUM_PATH=/opt/selenium/selenium-server-latest.jar
SELENIUM_PORT=5555
@jpcaparas
jpcaparas / mnt-sharesies.mount
Created June 27, 2019 23:21
CIFS mount systemd
[Unit]
Description=sharesies mount
Requires=network-online.target
After=network-online.service
[Mount]
What=//192.168.1.200/Sharesies
Where=/mnt/sharesies
Options=username=user,password=pass,rw,iocharset=utf8,vers=2.0
Type=cifs
@jpcaparas
jpcaparas / commands.sh
Last active July 14, 2019 09:15
docker-compose systemd template
# Start the service
sudo systemctl start docker-compose@myservice
# Enable the service at runtime
sudo systemctl enable docker-compose@myservice
# Disable the service at runtime
sudo systemctl enable docker-compose@myservice
# Stop the service
@jpcaparas
jpcaparas / README.md
Created August 14, 2019 08:38 — forked from stokkes/README.md
Rclone Plex Sonarr Radarr Read&Write

Rclone v1.40 for Plex/Sonarr/Radarr Read/Write

This small guide should help you get setup with rclone v1.40 to read/write directly to a cache mount and have Plex get notified of new tv/movies that get added to the mount by Radarr/Sonarr

Assumptions

  1. You're using rclone v1.40
  2. You're using Radarr & Sonarr
  3. If you're using docker for plex/sonarr/radrr, you must ensure the volumes attached to the containers are all the same path, i.e.: /mnt/user/media:/media for all 3. If not, the auto-scan will likely not work properly.
@jpcaparas
jpcaparas / BenchmarksPerformance.php
Last active August 24, 2020 03:37
Dumps or logs performance in Laravel
<?php
/**
* Dumps or logs performance of code.
*/
class BenchmarksPerformance
{
private static $startTime;
private static $startLine;
@jpcaparas
jpcaparas / script.js
Last active December 16, 2024 23:54
Tampermonkey: Load an external script and CSS
// ==UserScript==
// @name HackerNews
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://news.ycombinator.com/
// @require https://bennettfeely.com/ztext/js/ztext.min.js
// @resource REMOTE_CSS http://127.0.0.1:8080/style.css
// @grant GM_xmlhttpRequest
@jpcaparas
jpcaparas / nginx.conf
Last active October 23, 2024 12:32
Make a node application work with PM2 & Laravel Forge
# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/<your-site>/before/*;
map $sent_http_content_type $expires {
"text/html" epoch;
"text/html; charset=utf-8" epoch;
default off;
}
server {