Skip to content

Instantly share code, notes, and snippets.

View benyanke's full-sized avatar

Ben Yanke benyanke

View GitHub Profile
@benyanke
benyanke / customizer-core.php
Last active April 11, 2018 03:56
Patched file for corporatesource wp theme to properly use layouts. From corporatesource/inc/customizer/core/
<?php
/**
* Core functions.
*
* @package corporatesource
*/
if ( ! function_exists( 'corporatesource_get_option' ) ) :
/**
@benyanke
benyanke / useful functions for .bashrc
Created May 10, 2018 19:37
Useful Bash functions
# Syntax: "repeat [times to repeat] [command]"
# example: "repeat
function repeat()
{
local i max
max=$1; shift;
for ((i=1; i <= max ; i++)); do # --> C-like syntax
eval "$@";
done
}
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Stmt1526438975317",
"Action": "*",
"Effect": "Allow",
"Resource": "*"
}
]
Creating nextcloudtmp_redis_nc_1 ... done
Creating nextcloudtmp_nextcloud-db_1 ... done
Creating nextcloudtmp_nextcloud-db_1 ...
Creating nextcloudtmp_nextcloud_1 ... done
Attaching to nextcloudtmp_nextcloud-db_1, nextcloudtmp_redis_nc_1, nextcloudtmp_nextcloud_1
nextcloud-db_1 | Initializing database
nextcloud-db_1 | 2018-06-14 21:51:15 0 [Warning] InnoDB: Failed to set O_DIRECT on file./ibdata1;CREATE: Invalid argument, ccontinuing anyway. O_DIRECT is known to result in 'Invalid argument' on Linux on tmpfs, see MySQL Bug#26662.
nextcloud-db_1 | 2018-06-14 21:51:15 0 [ERROR] InnoDB: preallocating 50331648 bytes for file ./ib_logfile1 failed with error 28
nextcloud-db_1 | 2018-06-14 21:51:15 0 [ERROR] InnoDB: Cannot set log file ./ib_logfile1 size to 50331648 bytes
@benyanke
benyanke / Client Script
Last active July 4, 2018 14:40
SSH Reverse Tunnel Configuration
#!/usr/bin/env bash
# run me in cron every minute and on boot
ssh revtun@[host] -i [keypath] -R 8202:localhost:22 -N -f
@benyanke
benyanke / restoreBackup.sh
Last active July 10, 2018 19:08
Backup Scripts
#!/bin/bash
# Run this script with sudo
[ `whoami` = root ] || { echo "Need to run as root"; exit 1; }
# Update config here and run the script - example values used below
export PASSPHRASE="12345678901234567890"
@benyanke
benyanke / gsysmon - POC
Created July 20, 2018 01:58
Proof of concept for a system stats monitor
package main
import (
"fmt"
"github.com/shirou/gopsutil/cpu"
"github.com/shirou/gopsutil/host"
"github.com/shirou/gopsutil/load"
"github.com/shirou/gopsutil/mem"
)
@benyanke
benyanke / Add to bottom of bashrc
Last active February 4, 2019 22:44
Serial gateway
##############################
# Load the serial console on shell open
##############################
echo ""
echo ""
echo ""
echo "######################"
echo "Loading serial console... press ctrl+c to drop to bash instead"
@benyanke
benyanke / Elastic Beanstalk Drop All Tables
Created February 15, 2019 05:59
This drops all the tables in elastic beanstalk
echo "SET FOREIGN_KEY_CHECKS = 0; `mysqldump --add-drop-table --no-data -h $RDS_HOSTNAME -u $RDS_USERNAME -p$RDS_PASSWORD $RDS_DB_NAME | grep 'DROP TABLE'` ;SET FOREIGN_KEY_CHECKS = 1;" | mysql -h $RDS_HOSTNAME -u $RDS_USERNAME -p$RDS_PASSWORD $RDS_DB_NAME
sudo apt-get install watchdog
sudo echo bcm2708_wdog >> /etc/modules
sudo cp /etc/watchdog.conf /etc/watchdog.conf.orig
sudo sed -i 's/^#max-load/max-load/' /etc/watchdog.conf
sudo reboot