Skip to content

Instantly share code, notes, and snippets.

View huettern's full-sized avatar

Noah Huetter huettern

View GitHub Profile
public void paint(Graphics g) {
Graphics2D g2 = (Graphics2D)g.create();
Area plotArea = new Area(new Ellipse2D.Double(center.x-radius, center.y-radius, diameter,diameter));
g2.setClip(plotArea);
}
%% Poly with skin
clear; clc;
l=1e-6; c0=1e-9;
r0=100; f0=1000; alpha=0.8;
w=[2000 3000];
w=(2*pi).*w;
@huettern
huettern / usbcdc.c
Last active June 4, 2017 12:42
ChibiOS C shell variables
/**
* File: usbcdc.h
*/
typedef struct
{
const char* name;
float* loc;
} usbcdcParameterStruct_t;
void usbcdcSetShellVars(const usbcdcParameterStruct_t** vars);
@huettern
huettern / delugedsetup.sh
Created June 7, 2017 19:26
Install deluged and deluge-webui on ubuntu
sudo adduser deluge --shell /dev/null --disabled-password --disabled-login
sudo apt install deluged deluge-webui
sudo gpasswd -a $USER deluge
cat <<EOF | sudo /etc/systemd/system/deluged.service
[Unit]
Description=Deluge Bittorrent Client Daemon
After=network-online.target
[Service]
@huettern
huettern / ocbackup.sh
Created September 19, 2017 18:41
ownCloud Backup script
#!/bin/bash
# Author: noah huetter - dlatch.com
#
# v2:
# - added database backup
# - partial file transfer for no big file junk on /tmp
# v3:
# - Variables for user settings
# - Comments and functions
#!/bin/bash
# GitLab Backup script
# Backup config
docker exec -t gitlab /bin/sh -c 'umask 0077; tar cfz /var/opt/gitlab/backups/$(date "+etc-gitlab-config-%s.tgz") -C / etc/gitlab'
# Backup data
sudo docker exec -t gitlab gitlab-rake gitlab:backup:create
# Delete old config
sudo find /srv/gitlab/data/backups/ -type f -name 'etc-gitlab-*' -mtime +30 -exec rm {} \;
# Copy to backup server
sudo rsync -rvz --delete "/srv/gitlab/data/backups" "/media/beeblebroxgitlab/backup"
#/bin/bash
# Outside port to be openned for incomming ssh connections
PORT=12322
# Host Name and Port of the announce destination using SSH
HOST=host.com
HOST_PORT=22
curl -s http://whatismyip.akamai.com/ | ssh outpost@$HOST -p$HOST_PORT "cat > ~/outpost_ip.txt; echo ":$PORT" >> ~/outpost_ip.txt"
# Make sure port is forwarded
#!/bin/bash
# GPG Key to use for data encryption
KEY_ID=3387FFED
# Host
HOST=`cat /var/services/homes/outpost/outpost_ip.txt`
USER=pi
if [ $# -ne 2 ]
#!/bin/bash
# GPG Key to use for data encryption
KEY_ID=3387FFED
# Host
HOST=`cat /var/services/homes/outpost/outpost_ip.txt`
USER=pi
# Check for input arguments
if [ $# -ne 2 ]
alias gpg2syno='/usr/local/gnupg/bin/gpg2'
# List keys
gpg2syno --list-keys
# Export private key
KEY_ID=12345678
gpg2syno -a --export-secret-keys $KEY_ID > secret-gpg.key
# Export public key