Skip to content

Instantly share code, notes, and snippets.

// A port of Source Engine / Quake Movement to Unity
// Made by CoolOppo
using System;
using UnityEditor.ShaderGraph;
using UnityEngine;
using UnityStandardAssets.CrossPlatformInput;
using UnityStandardAssets.Utility;
using Random = UnityEngine.Random;
@CoolOppo
CoolOppo / Embedding-Executables.md
Created July 21, 2014 04:34
How to Embed an exe Inside Another exe as a Resource and Then Launch It

How to Embed an exe Inside Another exe as a Resource and Then Launch It

While working on a utility project today, I stumbled upon wanting to embed an executable inside another executable. Sounds fun doesn’t it? And what is even more fun is to be able to launch the embedded exe!

Basically, here’s how it works. You embed Foo.exe inside Bar.exe. And by embed I mean, add Foo.exe as a resource in Bar.exe and then, from Bar.exe’s code, you can launch Foo.exe using CreateProcess().

So before answering the "Why?" lets answer the "How?"

Rename Foo.exe to Foo.txt. We do this just to be safe and to prevent the resource compiler (manager) from throwing unwanted errors. Now add Foo.txt as a normal resource in Bar.exe. Create an entry in Bar.exe’s resource script as below:

@CoolOppo
CoolOppo / Cargo.toml
Last active January 2, 2024 10:27
How to compile to a DLL in rust while using it as a normal rust library
[package]
name = "test"
version = "0.1.0"
authors = ["YOU <YOU@users.noreply.github.com>"]
edition = "2018"
[lib]
crate-type = ["cdylib"]
; The name of the installer
Name "YOURPROGRAM"
; To change from default installer icon:
;Icon "YOURPROGRAM.ico"
; The setup filename
OutFile "YOURPROGRAM_Setup.exe"
; The default installation directory
@CoolOppo
CoolOppo / Vim Commands Cheat Sheet.md
Created February 5, 2014 20:47
Vim Commands Cheat Sheet

Source

Vim Commands Cheat Sheet


How to Exit

:q[uit]

@CoolOppo
CoolOppo / optimal-video-to-gif-imagemagick.md
Last active November 7, 2023 15:24
Converting videos to GIFs optimally using ImageMagick

ImageMagick Video to GIF Optimization Summary

A software developer who uses IM to create Movie GIFs, Benoit Rouleau, in discussion with me, gave me a AVI video of a plane flying over, to help us mutually explore IM video conversion techniques.

However while the AVI itself is quite small, the uncompressed video is a

@CoolOppo
CoolOppo / settings.json
Last active September 1, 2023 08:56
My VS Code settings
{
"C_Cpp.clang_format_style": "file",
"C_Cpp.default.cStandard": "c11",
"C_Cpp.default.cppStandard": "c++17",
"bracket-pair-colorizer-2.highlightActiveScope": true,
"bracket-pair-colorizer-2.showBracketsInGutter": true,
"bracket-pair-colorizer-2.showHorizontalScopeLine": false,
"breadcrumbs.enabled": true,
"editor.dragAndDrop": false,
"editor.find.autoFindInSelection": true,

Batch Cheat Sheet

For more information on a specific command, type HELP command-name

Command Description
ASSOC Displays or modifies file extension associations.
ATTRIB Displays or changes file attributes.
BREAK Sets or clears extended CTRL+C checking.
BCDEDIT Sets properties in boot database to control boot loading.
/*
* Chemical equation balancer
*
* Copyright (c) 2014 Project Nayuki
* All rights reserved. Contact Nayuki for licensing.
* http://www.nayuki.io/page/chemical-equation-balancer-javascript
*/
"use strict";

Neutering the “developer mode” screen on your Chromebook

I am the proud owner of two Chromebooks – one Samsung Series 3 ARM Chromebook and one Samsung 550 Chromebook. Like many serial tinkerers the frowny/sick developer “warning” screen, which you get if you want to overwrite the operating system having to enable developer mode, is more of a pain than anything, much as I recognise it is for security. Having to press CTRL + D at every boot, or wait 30 seconds and endure a loud, audible beep is not my idea of slick fun. Happily, it is possible to all but disable this screen, by rewriting the BIOS with the correct “flags”. This leaves the screen enabled, but it only displays for 2 seconds, and there is no beep. Unhappily, you have to physically open the Chromebook up and disable the inbuilt BIOS write protect to take advantage of this.

The procedure is a follows:

  • Open Chromebook and enable/disable write protect jumpe