Skip to content

Instantly share code, notes, and snippets.

View BenMcLean's full-sized avatar

Benjamin McLean BenMcLean

View GitHub Profile
@BenMcLean
BenMcLean / lolwut.cpp
Last active September 28, 2020 21:19
Simple data structure that encapsulates an array in C++
#include <iostream>
using namespace std;
template <class T>
class lolwut // a lolwut is a simple encapsulated array
{
public:
lolwut() : data(NULL), size(0)
{
@BenMcLean
BenMcLean / get-state.bat
Last active July 27, 2019 18:17
Oculus Quest ADB stuff
@ECHO OFF
c:
cd %APPDATA%
cd ..\Local\Android\Sdk\platform-tools
adb get-state
@BenMcLean
BenMcLean / 3dify-REDHydrogenOneDownmix.bat
Last active May 27, 2022 15:18
Uses https://ffmpeg.org/ to tag a video file as being SBS 3D. Just drag+drop the video file onto this batch file in same folder with ffmpeg.exe
@ECHO OFF
cd %~dp0
ffmpeg.exe -i "%~1" -c:v copy -c:a aac -af "pan=stereo|FL=0.5*FC+0.707*FL+0.707*BL+0.5*LFE|FR=0.5*FC+0.707*FR+0.707*BR+0.5*LFE,volume=1.660156" -metadata:s:v:0 stereo_mode=1 "%~n1_half_2x1.mp4"
echo Output file is: "%~n1_half_2x1.mp4"
@PAUSE
@BenMcLean
BenMcLean / VirtualBoyGo.ps1
Last active July 12, 2019 01:19
VirtualBoyGo powershell
<#
.SYNOPSIS
Downloads VirtualBoyGo source code
.DESCRIPTION
Gathers all dependencies and places them in the correct folders!
.NOTES
Author : Benjamin McLean [email protected]
.LINK
https://github.com/CidVonHighwind/VirtualBoyGo
#>
@BenMcLean
BenMcLean / .gitconfig
Created February 14, 2019 22:53
apply-gitignore alias for Git
[alias]
                apply-gitignore = !git ls-files -ci --exclude-standard -z | xargs -0r git rm --cached
@BenMcLean
BenMcLean / darkplaces.service
Last active October 25, 2018 03:03
darkplaces-server as a systemd service on Ubuntu
[Unit]
Description=This service spawns a Darkplaces Quake dedicated server.
# Place this file in /lib/systemd/system
# To enable this service to launch at boot time, enter in a terminal: systemctl enable darkplaces.service
# To disable this service from launching at boot time, enter in a terminal: systemctl disable darkplaces.service
# To check the state of all existing unit files, enter in a terminal: systemctl list-unit-files
# I followed these instructions to install Darkplaces, except for the parts about starting the dedicated server on boot because those parts don't work anymore: https://ubuntuforums.org/showthread.php?t=2095900
# I based this service on https://github.com/cdev-tux/q3lite/blob/ba3f578b0dc93f2af645724fad283e7484b8d77e/misc/q3lite/pi/q3lite_ded.service
[Service]
@BenMcLean
BenMcLean / TestApp.java
Last active October 6, 2018 04:40
Simple libGDX app
import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application;
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.utils.viewport.FitViewport;
@BenMcLean
BenMcLean / movegit.bat
Last active May 27, 2022 15:19
Batch file to transfer a Git repository to a different remote repo
cd %~dp0
for %%g in ("%1") do set "Folder=%%~ng"
mkdir %Folder%
cd %Folder%
git clone --mirror %1
cd %Folder%.git
git config --unset core.bare
git remote remove origin
git remote add origin %2
git push -u origin --all
@BenMcLean
BenMcLean / powershell.bat
Last active October 30, 2022 22:57
Launch Powershell script .ps1 from identically named batch script .bat
@ECHO OFF
cd %~dp0
PowerShell.exe -NoProfile -ExecutionPolicy Bypass -Command "& '%~dpn0.ps1' %1 %2 %3 %4 %5 %6 %7 %8"
@PAUSE
@BenMcLean
BenMcLean / cleanDist.ps1
Created November 29, 2017 23:19
Use BFG to strip out old web builds from my repositories that use Github Pages
param ($name)
Set-PSDebug -Trace 2
git clone --mirror https://github.com/BenMcLean/$name.git
java -jar bfg.jar --delete-folders dist "$name.git"
cd ./$name.git
git push
cd..
Remove-Item -Path "$name.git" -Recurse -Force