Skip to content

Instantly share code, notes, and snippets.

View devthejo's full-sized avatar

Jo devthejo

View GitHub Profile
@devthejo
devthejo / automount
Created March 1, 2019 18:12
cryfs automount bash script
#!/bin/bash
export CRYFS_FRONTEND=noninteractive
export CRYFS_NO_UPDATE_CHECK=noninteractive
CLOUD_DIR="${HOME}/.cloud"
BASE_DIR="${CLOUD_DIR}/Drive.cryfs"
MOUNT_DIR="${CLOUD_DIR}/Drive"
CONFIG_FILE="${CLOUD_DIR}/cryfs.config"
PASSWORD="mypassword"
if [ ! -d "$MOUNT_DIR" ]; then
mkdir $MOUNT_DIR
@devthejo
devthejo / vsftpduser.sh
Created March 27, 2018 11:23
vsftpd virtual user management with quota CLI
#!/bin/bash
VIRTUAL_USERS_DIR=${VIRTUAL_USERS_DIR:-/ftp_users}
DISKS_DIR=${DISKS_DIR:-/ftp_disks}
ROOT_DIR=${ROOT_DIR:-/ftp_mountpoints}
USER_QUOTA=${USER_QUOTA:-100MB}
DEFAULT_FTP_USER_ID=${DEFAULT_FTP_USER_ID:-14}
DEFAULT_FTP_GROUP_ID=${DEFAULT_FTP_GROUP_ID:-50}
CHMOD=${CHMOD:-0777}
@devthejo
devthejo / rules-both.iptables
Created March 25, 2018 15:29 — forked from jirutka/rules-both.iptables
Basic iptables template for ordinary servers (both IPv4 and IPv6)
###############################################################################
# The MIT License
#
# Copyright 2012-2014 Jakub Jirutka <jakub@jirutka.cz>.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
function promiseAllRecursive(value) {
if (value instanceof Promise) {
return value;
}
if (value instanceof Array) {
return Promise.all(value.map(promiseAllRecursive));
}
export default function hasPromise(mixed, stack=new Set()){
if(stack.has(mixed)){
return;
}
stack.add(mixed);
if(mixed instanceof Promise){
return true;
}
if(typeof mixed == 'object' && mixed !== null){
mixed = Object.values(mixed);
@devthejo
devthejo / fix-git-commits.sh
Created February 18, 2017 01:48
change email across git repo history
#!/bin/sh
git filter-branch --env-filter '
OLD_EMAIL="jo@surikat"
CORRECT_NAME="jo"
CORRECT_EMAIL="jo@surikat.pro"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_COMMITTER_NAME="$CORRECT_NAME"
export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
@devthejo
devthejo / vsftpd-user
Last active February 17, 2017 18:16
vsftpd virtual users management made easy
#!/usr/bin/env php
<?php
$rootDir = '/var/www/html/';
$file = '/etc/vsftpd/ftpd.passwd';
$username = getenv('USERNAME') ?: getenv('USER');
if($username!='root'){
echo "You must run this script as root: sudo vsftpd-user ...\n";
exit;
}
$map = [];
#!/bin/bash
#===============================================================================
#
# FILE: getgeo.sh
#
# USAGE: ./getgeo.sh
#
# DESCRIPTION: run the script so that the geodata will be downloaded and inserted into your
# database
#
#!/bin/bash
#===============================================================================
#
# FILE: getgeo.sh
#
# USAGE: ./getgeo.sh
#
# DESCRIPTION: run the script so that the geodata will be downloaded and inserted into your
# database
#