Skip to content

Instantly share code, notes, and snippets.

View BenMcLean's full-sized avatar

Benjamin McLean BenMcLean

View GitHub Profile
@tansey
tansey / gist:1375526
Created November 18, 2011 03:40
Linear regression in C#
/// <summary>
/// Fits a line to a collection of (x,y) points.
/// </summary>
/// <param name="xVals">The x-axis values.</param>
/// <param name="yVals">The y-axis values.</param>
/// <param name="inclusiveStart">The inclusive inclusiveStart index.</param>
/// <param name="exclusiveEnd">The exclusive exclusiveEnd index.</param>
/// <param name="rsquared">The r^2 value of the line.</param>
/// <param name="yintercept">The y-intercept value of the line (i.e. y = ax + b, yintercept is b).</param>
/// <param name="slope">The slop of the line (i.e. y = ax + b, slope is a).</param>
from kivy.clock import Clock
from kivy.core.window import Window
from kivy.uix.scatter import ScatterPlane
class Viewport(ScatterPlane):
def __init__(self, **kwargs):
kwargs.setdefault('size', (1920, 1080))
kwargs.setdefault('size_hint', (None, None))
kwargs.setdefault('do_scale', False)
@liamja
liamja / mirc.ini
Created April 28, 2013 14:26
Monokai colour scheme for mIRC.
[colors]
n5=Monokai,0,4,4,4,2,3,4,3,6,6,3,1,2,2,5,1,5,4,2,4,0,0,1,0,1,14,5,0,0,1
[palettes]
n5=2238503,15923448,15718758,3072678,7481081,12767183,2070525,26832,1632504,57344,94740,16776960,16515072,16711935,8355711,13816530
@KdotJPG
KdotJPG / OpenSimplex2S.java
Last active April 29, 2024 17:30
Visually isotropic coherent noise algorithm based on alternate constructions of the A* lattice.
/**
* K.jpg's OpenSimplex 2, smooth variant ("SuperSimplex")
*
* More language ports, as well as legacy 2014 OpenSimplex, can be found here:
* https://github.com/KdotJPG/OpenSimplex2
*/
public class OpenSimplex2S {
private static final long PRIME_X = 0x5205402B9270C86FL;
@dedunumax
dedunumax / .gitignore Java
Last active May 4, 2024 15:45
A complete .gitignore file for Java.
##############################
## Java
##############################
.mtj.tmp/
*.class
*.jar
*.war
*.ear
*.nar
hs_err_pid*
@KdotJPG
KdotJPG / OpenSimplexNoiseTileable3D.java
Created December 25, 2014 13:18
Tileable 3D OpenSimplex Noise
/*
* OpenSimplex Noise in Java.
* by Kurt Spencer
*
* Tileable 3D version, preliminary release.
* Could probably use further optimization.
*
* w6, h6, and d6 are each 1/6 of the repeating period.
* for x, y, z respectively. If w6 = 2, h6 = 2, d6 = 2,
* then the noise repeats in blocks of (0,0,0)->(12,12,12)
@mayukojpn
mayukojpn / facebook-mass-delete-group-members.js
Last active November 8, 2018 05:11 — forked from michaelv/facebook-mass-delete-group-members.js
This javascript removes all users from a facebook group. It works with the new facebook layout. Paste this in the javascript console. Script tested in Firefox. Known issues: 1. when facebook responds slowly, the script might experience hickups.. 2. occasionially, the error 'this user is not a member of the group' pops up.. IMPORTANT: add your ow…
var deleteAllGroupMembers = (function () {
var deleteAllGroupMembers = {};
// the facebook ids of the users that will not be removed.
// IMPORTANT: add your own facebook id here so that the script will not remove yourself!
var excludedFbIds = ['1234','11223344']; // make sure each id is a string!
var usersToDeleteQueue = [];
var scriptEnabled = false;
var processing = false;
deleteAllGroupMembers.start = function() {
@BenMcLean
BenMcLean / tictactoe.bat
Created March 10, 2016 04:32
Windows Batch Tic-Tac-Toe
@echo off
setLocal EnableDelayedExpansion
:newgame
cls
echo TIC-TAC-TOE
echo Written by Benjamin McLean
echo.
echo Controls:
echo|set /p="7 | 8 | 9"
echo.
@henriquemenezes
henriquemenezes / android-generate-keystores.md
Last active May 2, 2024 21:33
Android: Generate Release/Debug Keystores

Android: Generate Release/Debug Keystores

Generate Keystores

Debug Keystore

$ keytool -genkey -v -keystore debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000 -dname "C=US, O=Android, CN=Android Debug"
@gunderson
gunderson / FlyCamera.cs
Last active January 15, 2024 16:31
Unity Script to give camera WASD + mouse control
using UnityEngine;
using System.Collections;
public class FlyCamera : MonoBehaviour {
/*
Writen by Windexglow 11-13-10. Use it, edit it, steal it I don't care.
Converted to C# 27-02-13 - no credit wanted.
Simple flycam I made, since I couldn't find any others made public.
Made simple to use (drag and drop, done) for regular keyboard layout