Skip to content

Instantly share code, notes, and snippets.

Avatar
😈
⠀Mostly guesswork...

Peter Repukat Alia5

😈
⠀Mostly guesswork...
View GitHub Profile
@Alia5
Alia5 / wsl2-network.ps1
Created Dec 8, 2021 — forked from daehahn/wsl2-network.ps1
WSL 2 TCP NETWORK FORWARDING
View wsl2-network.ps1
# WSL2 network port forwarding script v1
# for enable script, 'Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope CurrentUser' in Powershell,
# for delete exist rules and ports use 'delete' as parameter, for show ports use 'list' as parameter.
# written by Daehyuk Ahn, Aug-1-2020
# Display all portproxy information
If ($Args[0] -eq "list") {
netsh interface portproxy show v4tov4;
exit;
}
@Alia5
Alia5 / cheatsheet.ts
Last active Jun 14, 2022
Advanced Typescript Cheatsheet
View cheatsheet.ts
export type Await<T> = T extends PromiseLike<infer U> ? Await<U> : T;
export type IsPromise<T> = PromiseLike<infer U> ? true : false;
export type Length<T> = T extends { length: infer L } ? L : never;
export type KeysOfType<O, T> = {
[K in keyof O]: O[K] extends T ? K : never;
}[keyof O];
// ConvertLiterals would convert literal types like `1337` to their base type like `number` if set to true
@Alia5
Alia5 / ConEmu.xml
Created Mar 5, 2021
My quake-style ConEmu config
View ConEmu.xml
<?xml version="1.0" encoding="utf-8"?>
<key name="Software">
<key name="ConEmu">
<key name=".Vanilla" modified="2021-02-11 00:25:29" build="210128">
<value name="StartType" type="hex" data="02"/>
<value name="CmdLine" type="string" data=""/>
<value name="StartTasksFile" type="string" data=""/>
<value name="StartTasksName" type="string" data="{Shells::cmd}"/>
<value name="StartFarFolders" type="hex" data="00"/>
<value name="StartFarEditors" type="hex" data="00"/>
@Alia5
Alia5 / WSL2-Net-Fix.ps1
Created Sep 30, 2020 — forked from danvy/WSL2-Net-Fix.ps1
Reset your WSL network connection trying to fix WSL2 media disconnected error
View WSL2-Net-Fix.ps1
# Check these threads before proceeding:
# https://github.com/microsoft/WSL/discussions/5857
# https://github.com/microsoft/WSL/issues/5821
if (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) {
$CmdLine = "-File `"" + $MyInvocation.MyCommand.Path + "`" " + $MyInvocation.UnboundArguments
Start-Process -FilePath PowerShell.exe -Verb Runas -ArgumentList $CmdLine
Exit
}
# Restart the Host Network Service
Restart-Service -Force -Name hns
@Alia5
Alia5 / GLSL-Noise.md
Created Mar 14, 2017 — forked from patriciogonzalezvivo/GLSL-Noise.md
GLSL Noise Algorithms
View GLSL-Noise.md

Generic 1,2,3 Noise

float rand(float n){return fract(sin(n) * 43758.5453123);}

float noise(float p){
	float fl = floor(p);
  float fc = fract(p);
	return mix(rand(fl), rand(fl + 1.0), fc);
}
@Alia5
Alia5 / Signals.h
Last active May 24, 2022
C++11 Signals/Slots implementation
View Signals.h
#ifndef SIGNALS_H
#define SIGNALS_H
#include <functional>
#include <list>
#include <memory>
template <typename... Args>
class ConnectionItem
{
@Alia5
Alia5 / transparent_sfml.cpp
Last active Mar 17, 2022
Transparent SFML Window
View transparent_sfml.cpp
#include <SFML/Graphics.hpp>
#include <Windows.h>
#include <Dwmapi.h>
#pragma comment (lib, "Dwmapi.lib")
int main()
{
sf::RenderWindow window(sf::VideoMode(1280, 720), "Transparent Window");
@Alia5
Alia5 / replace-classes-in-apk.sh
Created Sep 21, 2016 — forked from sebfisch/replace-classes-in-apk.sh
Replaces classes in Android Package Files
View replace-classes-in-apk.sh
#!/bin/bash
# Replaces classes in Android Package Files
# (c) Sebastian Fischer, CC-BY
# Can be used to rebuild an App with a modified version of a used library,
# as required for closed works that link to an LGPL library.
# Depends on: https://code.google.com/p/dex2jar/
View Launch_UWP_APP_C#
public enum ActivateOptions
{
None = 0x00000000, // No flags set
DesignMode = 0x00000001, // The application is being activated for design mode, and thus will not be able to
// to create an immersive window. Window creation must be done by design tools which
// load the necessary components by communicating with a designer-specified service on
// the site chain established on the activation manager. The splash screen normally
// shown when an application is activated will also not appear. Most activations
// will not use this flag.
NoErrorUI = 0x00000002, // Do not show an error dialog if the app fails to activate.
View launch_uwp_win32.cpp
#include <iostream>
#include <Windows.h>
#include <atlbase.h>
#include <Shobjidl.h>
#include <appmodel.h>
#include <AppxPackaging.h>
#include <string>
HRESULT LaunchApplication(LPCWSTR packageFullName, PDWORD pdwProcessId)
{