Skip to content

Instantly share code, notes, and snippets.

View arxae's full-sized avatar

Andy Maesen arxae

View GitHub Profile
@arxae
arxae / cl.js
Created June 13, 2021 22:42
console.log stuff
export function getConsole(name: string, color: string) {
const newConsole : Console = Object.create(console);
newConsole.log = console.log.bind(console, `%c[${name}]`, `color: ${color}`);
newConsole.warn = console.warn.bind(console, `[${name}]`);
newConsole.error = console.error.bind(console, `[${name}]`);
newConsole.time = (label?: string) => console.time(`[${name}] ${label}`);
newConsole.timeEnd = (label?: string) => console.timeEnd(`[${name}] ${label}`);
return newConsole;
}
This file has been truncated, but you can view the full file.
{
"missionRewards": {
"Mercury": {
"Apollodorus": {
"gameMode": "Survival",
"isEvent": false,
"rewards": {
"A": [
{
"_id": "fc25008a1520110a9534065e0d1e3765",
@arxae
arxae / SkipWhenPreviousJobIsRunningAttribute.cs
Created January 10, 2019 00:17
Apply to class that executes a job in Hangfire. If a recurring job with this attribute is already running, a new one won't start
using System;
using System.Collections.Generic;
using Hangfire.Client;
using Hangfire.Common;
using Hangfire.States;
using Hangfire.Storage;
/// <summary>
/// Makes sure that 2 (or more) same jobs will not be run twice at the same time.
@arxae
arxae / gist:8baa5e4d49416f643703bbb195591210
Created March 28, 2017 21:33
Simple roguelike map drawing in c# console
using System;
using System.Collections.Generic;
namespace rlike
{
class Program
{
static Random Rng;
static void Main(string[] args)
@arxae
arxae / TaskQueueRunner.cs
Created December 26, 2016 03:23
Loops over a list to keep tasks running with a max ammount
using System;
using System.Collections.Generic;
using System.Collections.Concurrent;
using System.Threading.Tasks;
using System.Threading;
namespace TestProject
{
class Program
{
@arxae
arxae / fossil-git.txt
Created August 2, 2016 06:55
Fossil <-> Git
Fossil -> Git
git init new-repo
cd new-repo
fossil export --git ../repo.fossil | git fast-import
git merge trunk
git branch -d trunk
Git -> Fossil
cd git-repo
@arxae
arxae / BitmapEx.cs
Created July 17, 2016 20:18
Change color of bitmap
public static class BitmapExt
{
public static void ChangeColour(this Bitmap bmp, byte inColourR, byte inColourG, byte inColourB, byte outColourR, byte outColourG, byte outColourB)
{
// Specify a pixel format.
PixelFormat pxf = PixelFormat.Format24bppRgb;
// Lock the bitmap's bits.
Rectangle rect = new Rectangle(0, 0, bmp.Width, bmp.Height);
BitmapData bmpData =
@arxae
arxae / archive.sh
Created July 6, 2016 03:24
Archives youtube channels.
#!/bin/sh
YOUTUBEDL='/usr/local/bin/youtube-dl' # Absolute path to youtube-dl executable
ARCHIVE='~/youtube_archive' # Absolute path to archive
$YOUTUBEDL -U
archive () {
mkdir -p "$ARCHIVE/$1"
cd "$ARCHIVE/$1"
@arxae
arxae / Singleton.cs
Last active December 18, 2015 07:27
Generic singleton pattern
// Usage: Singletone<classtype>.Instance
public sealed class Singleton<T> where T : new()
{
public static T Instance => Inner.InnerInstance;
private Singleton() { }
private class Inner
{
internal static T InnerInstance = new T();
@arxae
arxae / CameraFollow.cs
Created August 22, 2014 10:53
[Unity] Smoothly follows the target. Attach to the camera
using UnityEngine;
public class CameraFollow : MonoBehaviour
{
public Transform Target;
public float Damping = 1f;
public float LookAheadFactor = 3f;
public float LookAheadReturnSpeed = 0.5f;
public float LookAheadMoveTreshold = 0.1f;