Skip to content

Instantly share code, notes, and snippets.

@bladeSk
bladeSk / SQLite-PHP-quickstart.php
Last active April 15, 2024 15:55
SQLite3 PHP Quickstart Tutorial
<?php
// This file walks you through the most common features of PHP's SQLite3 API.
// The code is runnable in its entirety and results in an `analytics.sqlite` file.
// Create a new database, if the file doesn't exist and open it for reading/writing.
// The extension of the file is arbitrary.
$db = new SQLite3('analytics.sqlite', SQLITE3_OPEN_CREATE | SQLITE3_OPEN_READWRITE);
// Errors are emitted as warnings by default, enable proper error handling.
@bladeSk
bladeSk / Unity-Linux-VSCode-Intellisense-Debugger.md
Last active April 9, 2024 11:42
How to install Unity3D on Ubuntu based Linux distros (Kubuntu, Xubuntu, POP_OS, Mint, Neon, Zorin, etc.).

How to install Unity3D on Ubuntu based Linux distros (Kubuntu, Xubuntu, POP_OS, Mint, Neon, Zorin, etc.).

This guide details how to install UnityHub, Unity, VS Code and how to get full C# support with IntelliSense and debugging.

Tested on Kubuntu 22.04.

Installing Unity Hub

Unity Hub won't run on Ubuntu newer than 20.04 because it depends on an outdated libssl. We need to manually install the package from 20.04:

@bladeSk
bladeSk / rulesmd.ini
Last active March 13, 2024 09:19
Restores the original units in Yuri's Revenge mission Hollywood and Vain - Arnie Frankenfurter, Flint Westwood, Sammy Stallion. Save rulesmd.ini alongside ra2md.exe
; RULE*.INI
; *** Red Alert 2: Yuri's Revenge Rules ***
; If placed in game directory, it will override built in values. Values to be used as multipliers
; or percentages can be specified as either a simple floating point number (embed ".") or as a
; conventional percentage number (append "%"). Values used as distances or time delays
; are specified as simple floating point number. Distance values are expressed in cells. Time
; values are expressed in minutes.
; If multiple rules files are present, the Name field is used to identify between them.
[General]
@bladeSk
bladeSk / laravel-on-shared-hosting-htaccess.md
Last active March 5, 2024 09:51
Deploying Laravel on a shared hosting using only .htaccess

Deploying Laravel on a shared hosting using only .htaccess

Making Laravel work on a shared hosting can be troublesome, because Laravel needs to have its document root set to the public directory. This may not be configurable by a user or even desirable, when the server is hosting multiple websites.

Here's a simple method using only a .htaccess file placed in Laravel's root directory - e.g. alongside app, bootstrap, config, ... No changes whatsoever are necessary to your code.

The file rewrites all the requests so that requesting /file.png would in fact return /public/file.png and anything else is routed to /public/index.php. This also ensures that nothing outside the public folder can be accessed, thereby protecting any sensitive files like .env or database/*.

The simple method

@bladeSk
bladeSk / mouse cursor follows focus.ahk
Last active April 5, 2022 02:57
AutoHotKey: Make mouse cursor follow window focus
; Makes the mouse cursor follow window focus, but ONLY if the focus change
; wasn't caused by the mouse - e.g. Alt-Tab, Win+<Number>, hotkeys, ...
; Saves a lot of mousing around on multi-monitor setups!
Gui +LastFound
lastMouseClickTime := 0
hWnd := WinExist()
DllCall("RegisterShellHookWindow", UInt, hWnd)
@bladeSk
bladeSk / index.html
Last active August 1, 2016 13:36
Basic WebGL example
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>basic webgl example</title>
<style>
body { margin: 0; }
canvas { display: block; }
</style>