Skip to content

Instantly share code, notes, and snippets.

View RednibCoding's full-sized avatar

Michael Binder RednibCoding

View GitHub Profile
/**
* Simple assert function that throws an error if the test is false
*/
export function assert(condition: unknown, msg?: string): asserts condition {
if (condition === false) throw new AssertionError(msg);
}
@RednibCoding
RednibCoding / 0 Dlang debuggin in vs-code.md
Last active May 27, 2024 14:06
Dlang debuggin in vs-code

Setup

To setup debugging for Dlang programs on Windows with VsCode follow these steps:

  • make sure you have the D Programming Language (code-d) (VsCode extension) installed
  • make sure you have the C/C++ extension pack (VsCode extension) installed
  • create a .vscode folder at the root of your Odin project
  • copy the launch.json and tasks.json into it
  • in the launch.json at line: "program": "./my-app.exe", change my-app.exe to your executable name (look in the dub.json under name).
  • click on the debug tab in VsCode, then click on the debug button at the top (or press F5)
@RednibCoding
RednibCoding / MmoCharacterController.cs
Last active November 9, 2023 09:16
MmoCharacterController for the flax engine
/*
How to use:
1. Create a CharacterController in your scene
2. Add an AnimatedModel (your player character) as child to the CharacterController
3. Adjust the size of the CharacterController capsule so it fits the size of your player character
4. Add a Camera as child to the CharacterController
5. Set the Layer of the CharacterController to "Player" (can be found under Properties->General->Layer while the PlayerController is selected)
6. Add this MmoCharacterController script to the CharacterController
*/
@RednibCoding
RednibCoding / Create a static library of a .c file.md
Last active May 12, 2024 07:25
Create a static library of a .c file for windows and linux

How do i create a static library file of my test.c with gcc?

You can create a static library .lib file using the GCC compiler by following these steps:

  1. Compile the source files into object files:
gcc -c test.c
@RednibCoding
RednibCoding / 0 Odin debugging on windows.md
Last active July 12, 2024 18:41
Odin debugging on windows with vscode. See: readme

Setup

To setup debugging for Odin programs on Windows with VsCode follow these steps:

  • make sure you have the C/C++ extension pack (VsCode extension) installed
  • create a .vscode folder at the root of your Odin project
  • copy the launch.json and tasks.json into it
  • click on the debug tab in VsCode, then click on the debug button at the top (or press F5)

Note: if you want to use a starter template which also sets up a tracking allocator which tracks and reports memory leaks you can use: https://github.com/RednibCoding/Odin-Starter

@RednibCoding
RednibCoding / enterprise_token.rb
Created August 17, 2022 16:57 — forked from markasoftware/enterprise_token.rb
OpenProject Enterprise mode for free
############ REPLACE app/models/enterprise_token.rb in the source code with this file! ################
############ also be sure to RESTART OpenProject after replacing the file. ################
############ it doesn't show that enterprise mode is enabled in the settings, but all ################
############ enterprise mode features, such as KanBan boards, are enabled. ################
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2020 the OpenProject GmbH
#
# This program is free software; you can redistribute it and/or
@RednibCoding
RednibCoding / nanorc
Last active October 20, 2019 21:46
Modern keybindings for the nano editor
# Copy/paste the following lines into the "nanorc" file
# File is usually located at: /etc/nanorc
# Set some colors
# set element fgcolor,bgcolor
set titlecolor black,green
set statuscolor black,green
set errorcolor brightwhite,red
set selectedcolor black,green
set stripecolor ,yellow
@RednibCoding
RednibCoding / process.go
Last active July 4, 2018 00:07
Example of how to open/read/write process memory on Windows with Golang
package main
import (
"bytes"
"encoding/binary"
"fmt"
"syscall"
"unsafe"
)
@RednibCoding
RednibCoding / ListProcesses.py
Last active June 29, 2018 22:30
Simple example of how to list all running processes with Python
import psutil
def listProcesses():
for proc in psutil.process_iter():
try:
pinfo = proc.as_dict(attrs=['pid', 'name'])
except psutil.NoSuchProcess:
pass
else:
print(pinfo)
@RednibCoding
RednibCoding / Install.py
Created June 21, 2018 06:50
How to install a Python package from github using Pycharm
"""
After loading the project (which was associated with the virtual environment that you want to update),
open PyCharm's Terminal window (Alt+F12, or View > Tool Windows > Terminal) and then use the following command:
"""
pip install git+URL_to_repository
"""
Where "URL_to_repository" is the package you want to install.