Skip to content

Instantly share code, notes, and snippets.

View evansharp's full-sized avatar
💫
Teaching

Evan Sharp evansharp

💫
Teaching
View GitHub Profile
@evansharp
evansharp / autosave.js
Created August 26, 2024 05:35 — forked from gcmurphy/autosave.js
Very simple autosave functionality using local storage
var AutoSave = (function(){
var timer = null;
function getEditor(){
var elems = document.getElementsByTagName("textarea")
if (elems.length <= 0)
return null;
@evansharp
evansharp / vps.sh
Created March 23, 2024 16:24 — forked from zipizap/vps.sh
#PROLOGUE: all this should be run as root, otherwise stated
#update && upgrade:
apt-get update && apt-get upgrade -y
#create a new user
adduser user_x
#create group admin (funny enough, it does not exist, although its accounted in the /etc/sudoers file):
addgroup --system admin
@evansharp
evansharp / my-domain-le-ssl.conf
Created July 11, 2022 16:45 — forked from DmitryRendov/my-domain-le-ssl.conf
DynMap Apache2 + ReverseProxy + LetsEncrypt configuration
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName map.mysite.by
ServerAlias www.map.mysite.by
UseCanonicalName On
TimeOut 30
# Identical to combined format, except that we swap remote-host (%h) with X-Forwared-For
@evansharp
evansharp / wp.sh
Last active February 9, 2021 23:47 — forked from bgallagh3r/wp.sh
Wordpress: Bash Install Script -- Downloads latest WP version, updates wp-config with user supplied DB name, username and password, creates and CHMOD's uploads dir, copies all the files into the root dir you run the script from, then deletes itself!
#!/bin/bash -e
clear
echo "============================================"
echo "WordPress Install Script"
echo "============================================"
echo "Database Name: "
read -e dbname
echo "Database User: "
read -e dbuser
echo "Database Password: "
#-------------------------
# Operating Specific Junk Files
#-------------------------
# OS X
.DS_Store
.AppleDouble
.LSOverride
# OS X Thumbnails
@evansharp
evansharp / git_fetch_pull_all_subfolders.sh
Created March 13, 2018 21:13 — forked from mnem/git_fetch_pull_all_subfolders.sh
Simple bash script for fetching and pulling all repos in the executed folder to the latest of the branch they are on
#!/bin/bash
################
# Uncomment if you want the script to always use the scripts
# directory as the folder to look through
#REPOSITORIES="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
REPOSITORIES=`pwd`
IFS=$'\n'
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
module RandomAttribute
def generate_unique_random_base64(attribute, n)
until random_is_unique?(attribute)
self.send(:"#{attribute}=", random_base64(n))
end
end
def generate_unique_random_hex(attribute, n)
until random_is_unique?(attribute)