Skip to content

Instantly share code, notes, and snippets.

View bobmoff's full-sized avatar

Fille bobmoff

View GitHub Profile
@bobmoff
bobmoff / ufw-dynamic-host-update
Created April 26, 2014 19:24
I found a very useful script that creates rules dynamically for specific hosts in this blog. The script needs to be run with cron, so it can lookup a hostname and add/delete rules in case the IP changed. The content of /etc/ufw-dynamic-hosts.allow could look like this: tcp:22:yourpc.no-ip.org and a crontab entry for executing the script every fi…
#!/bin/bash
HOSTS_ALLOW=/etc/ufw-dynamic-hosts.allow
IPS_ALLOW=/var/tmp/ufw-dynamic-ips.allow
add_rule() {
local proto=$1
local port=$2
local ip=$3
@bobmoff
bobmoff / Unity Server in Docker Container
Last active September 24, 2022 15:55
Running Unity headless unix build in Docker container on Docker Cloud
@bobmoff
bobmoff / UIView+RoundedCorners.h
Created July 10, 2013 15:23
Add rounded corners to any view using layer mask.
#import <UIKit/UIKit.h>
@interface UIView (RoundedCorners)
- (void)setRoundedCorners:(UIRectCorner)corners radius:(CGSize)size;
@end
@bobmoff
bobmoff / UIView+ModifyFrame.h
Last active November 27, 2021 06:58
Simple but really useful category on UIView that makes modifying the frame NOT hellish. Published under WTFPL [http://www.wtfpl.net/]. Usage example can be found in the comments
/*
Before:
CGRect frame = myView.frame;
frame.origin.x = newX;
myView.frame = frame;
After:
myView.x = newX;
@bobmoff
bobmoff / MongoDB Install Script
Last active October 22, 2021 21:28
Script to Install MongoDB on Ubuntu / Digital Ocean Droplet
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | tee /etc/apt/sources.list.d/mongodb.list
apt-get -y update
apt-get install -y mongodb-org
@bobmoff
bobmoff / install-caddy-on-ubuntu.sh
Created August 16, 2021 09:12
Install Caddy on Ubuntu (Script)
#!/bin/bash
sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo tee /etc/apt/trusted.gpg.d/caddy-stable.asc
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
sudo apt update
sudo apt install -y caddy
@bobmoff
bobmoff / install-elixir-on-ubuntu.sh
Last active August 16, 2021 07:57
Install Elixir on Ubunti (Bash Script)
#!/bin/bash
wget https://packages.erlang-solutions.com/erlang-solutions_2.0_all.deb && sudo dpkg -i erlang-solutions_2.0_all.deb
sudo apt-get update
sudo apt-get install -y esl-erlang
sudo apt-get install -y elixir
@bobmoff
bobmoff / remote_script.sh
Last active August 16, 2021 07:36
Just a test
echo "hello there"
echo "hello again"
parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({
//
// SKNode+TouchPriority.h
// ButtonLab
//
// Created by Fille Åström on 10/20/13.
// Copyright (c) 2013 IMGNRY. All rights reserved.
//
#import <SpriteKit/SpriteKit.h>