Skip to content

Instantly share code, notes, and snippets.

@Maxstupo
Maxstupo / run-from.sh
Created March 23, 2017 07:54
Run bash script from url
#!/bin/bash
curl -s $1 | sudo bash /dev/stdin
# Usage: bash run-from.sh <url-to-bash-script>
@Maxstupo
Maxstupo / install-wordpress.sh
Last active September 15, 2018 17:50
Install Wordpress
#!/bin/bash
#
# Program: install_wordpress.sh
# Purpose: Installs WordPress (Tested on Ubuntu Server 16.04.2 LTS)
# Date: 23/03/2017
# Author: Maxstupo
#
# Command Line Arguments:
# $1 = the username for ownership of files (default: admin)
# $2 = the new db user password (default: password)
@Maxstupo
Maxstupo / MouseLook.cs
Last active September 8, 2017 09:44
Allows the mouse to rotate two game object transforms.
using System;
using UnityEngine;
/* ********************************************************************************************
* Program: MouseLook.cs
* Purpose: Allows the mouse to rotate two game object transforms.
* Date: 3/04/2017
* Author: Maxstupo
* ****************************************************************************************** */
public class MouseLook : MonoBehaviour {
@Maxstupo
Maxstupo / MovementController.cs
Created April 3, 2017 16:40
MovementController.cs
using System;
using UnityEngine;
using System.Collections;
[RequireComponent(typeof(Rigidbody))]
[RequireComponent(typeof(CapsuleCollider))]
public class MovementController : MonoBehaviour {
[Serializable]
public enum Movement {
@Maxstupo
Maxstupo / EventSystem.js
Last active February 8, 2018 13:14
A event system to provide event handling.
/**
* The EventSystem provides basic event handling.
*
* A basic example:
* <pre><code>
* let es = new EventSystem();
*
* let listenerId = es.on('myEvent', function() { // Register a new event listener for the event 'myEvent'.
* console.log('Hello World!!');
* });
@Maxstupo
Maxstupo / ObjectPool.cs
Last active May 21, 2020 10:46
A generic object pool in C#
using System;
using System.Collections.Generic;
//TODO: Implement the IDisposable interface to allow pooled objects to be freed by the using keyword.
public interface IPoolable {
void ResetObject();
}
public abstract class ObjectPool<T> where T : IPoolable {
@Maxstupo
Maxstupo / JQueryTemplate.plugin.js
Last active December 21, 2018 05:46
A jQuery plugin template.
(function ($) {
const PLUGIN_NAME = 'myplugin'; // The name of the plugin method. (Function name of the plugin)
const DATA_NAME = 'jqp_' + PLUGIN_NAME; // The id of the plugin instance attached to each element that this plugin was initialized on. (https://api.jquery.com/data/)
const MyPlugin = function ($el, newOptions) {
const _this = this;
this.$el = $el; // Expose jQuery object this plugin is attached to.
/* ---------------- Options Setup --------------- */
@Maxstupo
Maxstupo / Ads.java
Created July 29, 2018 06:11
A helper class for AdMob ads
import android.app.Activity;
import android.location.Location;
import android.view.View;
import com.google.android.gms.ads.AdListener;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
import com.google.android.gms.ads.MobileAds;
/*
@Maxstupo
Maxstupo / nas_plex_installer.sh
Last active January 23, 2020 09:39
Ubuntu Media NAS (Samba & Plex + Webmin)
#!/bin/bash
#
# ----- WARNING: This script is a work in progress ------
#
# NAS Media Server Install Script
#
# Installs SSH, Webmin, Samba, and Plex.
# Upgrade
@Maxstupo
Maxstupo / Canvas.cs
Created July 12, 2019 15:59
A control suitable for drawing 2D graphics, with zoom and pan functionality.
using System;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
namespace Maxstupo.Controls {
/// <summary>
/// Provides a surface suitable for drawing 2D graphics, with zoom and pan functionality.
/// </summary>