Skip to content

Instantly share code, notes, and snippets.

View aweijnitz's full-sized avatar

Anders Weijnitz aweijnitz

View GitHub Profile
@aweijnitz
aweijnitz / kubernetes-basics
Last active February 19, 2020 21:02
kubernetes basics with minikube
# Installation (Mac)
brew update; brew install minikube
minikube version
minikube start
# kubectl
kubectl version
@aweijnitz
aweijnitz / partitionSpaceMonitor.sh
Created November 3, 2019 10:12
Shell script to run as a cron job and "run command" to prevent motionEyeOS from filling up the /data partition
#!/bin/bash
CURRENT=$(df /data/output | grep /dev | awk '{ print $5}' | sed 's/%//g')
THRESHOLD_CLEAN=60
THRESHOLD_FULL=85
if [ "$CURRENT" -gt "$THRESHOLD_CLEAN" ] ; then
find /data/output -type f -mtime +3 -exec rm -f {} \;
fi
if [ "$CURRENT" -gt "$THRESHOLD_FULL" ] ; then
@aweijnitz
aweijnitz / installJava8.sh
Last active April 19, 2019 12:42
Provisioning script for non-interactive Java8 installation on Linux
#!/bin/sh
# From http://www.webupd8.org/2014/03/how-to-install-oracle-java-8-in-debian.html
#
# You need to run this script as root
#
# su -
echo "INSTALLING JAVA 8 AS USER `whoami` "
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee /etc/apt/sources.list.d/webupd8team-java.list
@aweijnitz
aweijnitz / Twitter UTC Date Parser
Created February 20, 2014 21:22
Parsing UTC time from Twitter's created_at field
import java.text.SimpleDateFormat;
import java.text.ParseException;
import java.util.Date;
import java.util.Locale;
/** Parse UTC time from Twitter's created_at field.
*
* Compile and run: javac TwitterDateParser.java && java TwitterDateParser
@aweijnitz
aweijnitz / .bash_profile
Created November 10, 2017 22:03 — forked from natelandau/.bash_profile
Mac OSX Bash Profile
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management
@aweijnitz
aweijnitz / install-cs.cart.sh
Created June 7, 2017 21:36
Install CS.Cart on Ubuntu 14.04
#!/bin/bash
# Based on http://docs.cs-cart.com/4.3.x/install/digitalocean.html
curl -sL http://cartoma.tk/installer | bash -s -- cart.is-by.us
cd /var/www/html/cart.is-by.us
wget "https://www.cs-cart.com/index.php?dispatch=pages.get_trial&page_id=297&edition=ultimate" -O cscart.zip && unzip cscart.zip
chown -R service ./
chmod 644 config.local.php
chmod -R 755 design images var
find design -type f -print0 | xargs -0 chmod 644
find images -type f -print0 | xargs -0 chmod 644
@aweijnitz
aweijnitz / sqlite3_example.js
Last active February 26, 2017 19:12
Example how to use SQLite with Node.js
/**
* Small refresher on how to use sqlite3 embedded in node.js
*
* LINKS:
* - Package: https://www.npmjs.com/package/sqlite3 (NOTE: Includes correct platform binary of sqlite3. No extra install required.)
* - API: https://github.com/mapbox/node-sqlite3/wiki/API
*/
var sqlite3 = require('sqlite3').verbose();
// var db = new sqlite3.Database('./dbfiles/testdb');
@aweijnitz
aweijnitz / RF Link 433Mhz receiver
Last active January 4, 2016 11:14
RF Link 433MHz debug setup for Arduino
@aweijnitz
aweijnitz / copySubmissions.php
Last active December 29, 2015 18:39
PHP script to copy ukulele advent calendar submissions using the day of month as base file name (i.e. 1.htm, 1.mp3, 1.jpg on Dec 1st and so on)
<html>
<head>
<title>My First PHP Page</title>
</head>
<body>
<?php
// Change these to actual directory paths (including trailing slash '/')
$SOURCE_DIR = '/Users/anders/tmp/from/';
$DESTINATION_DIR = '/Users/anders/tmp/to/';
@aweijnitz
aweijnitz / remoteBackup.sh
Created May 21, 2015 13:00
rsync based remote backup
#!/bin/bash
sudo rsync -avz --delete --one-file-system / /boot backupuser@80.86.92.244:/home/hydrobackup/backups