Skip to content

Instantly share code, notes, and snippets.

View Emzi0767's full-sized avatar

Mateusz Brawański Emzi0767

View GitHub Profile
@Emzi0767
Emzi0767 / Dictionary2Lookup.cs
Created September 22, 2020 16:47
An elaborate shitpost. Transforms TKey-indexed dictionaries into T-indexed lookups.
// Copyright 2020 Emzi0767
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
@Emzi0767
Emzi0767 / EzPasswords.cs
Created September 22, 2020 16:45
Simple password-like string generator.
// Copyright 2020 Emzi0767
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// Copyright 2020 Emzi0767
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
@Emzi0767
Emzi0767 / EventDispatchData.cs
Last active August 5, 2019 20:42
Asynchronous Event Queue
internal interface IEventDispatchData<TSender, out TArgs>
where TArgs : AsyncEventArgs
{
Task InvokeAsync();
}
internal sealed class EventDispatchData<TSender, TArgs> : IEventDispatchData<TSender, TArgs>
where TArgs : AsyncEventArgs
{
public AsyncEvent<TSender, TArgs> Event { get; }
// Copyright 2019 Emzi0767
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
@Emzi0767
Emzi0767 / speed.sh
Last active July 13, 2020 20:10
Totally safe
#!/bin/sh
if [ "$(id -u)" != "0" ]
then
echo "This needs to be ran as root"
exit
fi
echo "Bamboozlin'"
for i in $(ls -1 /dev | egrep "^sd|^nmve|^hd|^vd|^ad|^d[a-z]|^mmcblk")
@Emzi0767
Emzi0767 / daemonize.ps1
Last active October 10, 2017 21:04
Your daemon script is bad; here, hold this.
# daemonize.ps1
#
# Daemonizes your Discord bot.
#
# Arguments:
# -Executable]
# Path to bot's executable.
#
# -Arguments
# Optional arguments for the bot.
@Emzi0767
Emzi0767 / backup_db.sh
Last active September 16, 2017 20:56
PostgreSQL backup script
#!/bin/bash
## README
#
# Automatic PostgreSQL backup script
# Version: v1.0.5
# Author: Emzi0767
# Usage:
# ./backup_db.sh <database> <username> <password> <max_count>
#
@Emzi0767
Emzi0767 / emzicord.css
Last active September 18, 2018 15:55
Discord CSS (for kicks and giggles). This mostly just removes lines and makes colour less blue.
/*
* Preview:
* v2017.1 https://awau.moe/2d0ccf.png
* v2017.2 https://awau.moe/d8302e.png
* v2018.1 I am too lazy to take screenshots
*/
/* Uncomment the following code if you want two-column guild selector.
.guilds-wrapper