Skip to content

Instantly share code, notes, and snippets.

View oliverbooth's full-sized avatar
🔷
Reticulating splines

Oliver Booth oliverbooth

🔷
Reticulating splines
View GitHub Profile
@oliverbooth
oliverbooth / Portal 2 TAB-toggle
Created November 7, 2014 17:10
Changes TAB to toggle co-op player's view instead of hold-to-use.
alias screen_open "+remote_view; bind TAB screen_close"; alias screen_close "-remote_view; bind TAB screen_open"; bind TAB "screen_open"
@oliverbooth
oliverbooth / gist:0426cd20cb95661e709b
Created November 15, 2014 23:19
Useful calculation to turn INDEX into X/Y-coordinates and vice-versa
i = x + (y * w)
x = i % w
y = i / w
@oliverbooth
oliverbooth / RepeatGround.cs
Created March 10, 2015 11:28
Hack for "repeating" ground
using UnityEngine;
using System.Collections;
public class RepeatGround : MonoBehaviour
{
public GameObject surfacePrefab;
public GameObject soilPrefab;
public Vector2 widthRange = new Vector2(-100, 100);
public int numLayers = 10;
@oliverbooth
oliverbooth / win-google-feud.js
Last active August 29, 2015 14:17
Instantly Win Google Feud
/* Run this in the Console of the developer tools in whatever browser you are using.
* (Usually, you can just hit F12 to open it)
*/
var r=window.gameData.googleResults;for(var i=0;i<r.length;i++){$("#rebox").val(r[i]);$("#guess").click()}
@oliverbooth
oliverbooth / decimal-conjecture
Created December 10, 2016 20:42
This seems to work...
/*
* return the number of zeros immediately proceeding the decimal point for any
* (-1 < n < 1)
*/
floor(abs(log10(abs(n))))
@oliverbooth
oliverbooth / ip-hotstring.ahk
Last active December 15, 2016 00:43
AutoHotkey hotstring for dumping your remote IP (using ipify)
; //ip macro by default - feel free to change this
; to whatever suits you best
;
; Oliver Davenport
:://ip::
whr := ComObjCreate("WinHttp.WinHttpRequest.5.1")
; default format from ipify api is text/plain
@oliverbooth
oliverbooth / .htaccess
Created January 15, 2017 06:19
htaccess snippet for forcing HTTPS through TLS/SSL on remote-only access
# Force HTTPS
RewriteCond %{SERVER_PORT} !^443$
RewriteCond %{REMOTE_ADDR} !127\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}
RewriteCond %{REMOTE_ADDR} !localhost
RewriteCond %{REMOTE_ADDR} !::1
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
/// <summary>
/// Calculates the Ackerman function for two values.
/// </summary>
/// <param name="m">The first value.</param>
/// <param name="n">The second value.</param>
/// <returns>Returns the result of the Ackerman function.</returns>
int Ackerman(int m, int n)
{
if (m == 0)
{
@oliverbooth
oliverbooth / FloatObject
Created April 2, 2020 03:42
Floating-like objects using UAssembly by VRChat
.data_start
.export amplitude
.export frequency
.sync x, smooth
.sync y, smooth
Vector3_tmp: %UnityEngineVector3, null
instance_0: %UnityEngineTransform, this
amplitude: %SystemSingle, 0.25
frequency: %SystemSingle, 1
public static void Main() {
FizzBuzz(100, new[]{("Fizz",3),("Buzz",5)});
}
public static void FizzBuzz(int c, (string,int)[] d) {
bool f(int n, int d)=>n%d==0;
for (int i=1;i<=c;i++) {
bool p=false;
for (int m=0;m<d.Length;m++) {