Skip to content

Instantly share code, notes, and snippets.

View pushrbx's full-sized avatar

pushrbx pushrbx

View GitHub Profile
# https://github.com/shayne/go-wsl2-host is needed for this
# a powershell command to setup the wslhost after you started the first wsl shell after a pc startup
# this will help you update the hosts file with the wsl's ip address
# it's kind of a workaround for a situation where you don't want to run wsl2-host app as a service
function setup-wslhost {
$myWindowsID=[System.Security.Principal.WindowsIdentity]::GetCurrent()
$myWindowsPrincipal=new-object System.Security.Principal.WindowsPrincipal($myWindowsID)
$adminRole=[System.Security.Principal.WindowsBuiltInRole]::Administrator
if ($myWindowsPrincipal.IsInRole($adminRole))
# powershell profile for oh-my-posh if you install it with winget, otherwise you need to import the oh-my-posh module
Import-Module posh-git
$ohmyposhversion = $(oh-my-posh --version)
$ohmyposhthemepath = "~/.oh-my-posh/themes/agnoster/v$ohmyposhversion"
# download a theme if not yet downloaded
if ((test-path $ohmyposhthemepath) -ne $true) {
new-item -itemType Directory -force -path $ohmyposhthemepath
$dwlurl = "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/v$ohmyposhversion/themes/agnoster.omp.json"
$themeFilePath = join-path -path $ohmyposhthemepath -childpath "agnoster.omp.json"
<template>
<div v-on-clickaway="clickAway">
<input type="text" class="form-control"
:value="value"
@focus="onFocus"
@input="onInput"
@keydown.enter.prevent="enter"
@keydown.down.prevent="down"
@keydown.up.prevent="up"
@keydown.tab="clickAway" />
@pushrbx
pushrbx / Microsoft.PowerShell_profile.ps1
Last active August 23, 2019 11:08
A function for your powershell profile which helps activating the python venv in PyCharm. (Assuming that you use the default folders offered by pycharm on project creation)
function IfTrue($a, $b, $c) { if ($a) { $b } else { $c } }
function Coalesce($a, $b) { if ($a -ne $null) { $a } else { $b } }
New-Alias "??" Coalesce
New-Alias "?:" IfTrue
function py-avenv {
param (
[Serializable]
public enum VKeys
{
KEY_0 = 0x30, //0 key
KEY_1 = 0x31, //1 key
KEY_2 = 0x32, //2 key
KEY_3 = 0x33, //3 key
KEY_4 = 0x34, //4 key
KEY_5 = 0x35, //5 key
KEY_6 = 0x36, //6 key
@pushrbx
pushrbx / qscript_read.py
Created October 22, 2018 21:17
Ugly python script which extracts the text from tb_Quest_Scripts_eng.res file of Soulworker into a json file.
import os
import json
import codecs
def read_block(f):
block_size = 0
index = int.from_bytes(bytes(f.read(4)), byteorder='little')
block_size += 4
len1 = int.from_bytes(bytes(f.read(2)), byteorder='little')
block_size += 2
@pushrbx
pushrbx / soul_worker_res_types.txt
Created October 22, 2018 18:57 — forked from x1nixmzeng/soul_worker_res_types.txt
Quick python script to dump the structures from Soul Worker Online
012640BC PUSH SoulWork.01C79544 ASCII "tb_Achievement"
01264666 PUSH SoulWork.01C79558 ASCII "tb_Achievement_begin"
0126478C PUSH SoulWork.01C79570 ASCII "tb_Achievement_Emblem"
01264AAC PUSH SoulWork.01C79588 ASCII "tb_Achievement_Script"
01264C66 PUSH SoulWork.01C795A0 ASCII "tb_Akashic_Disassemble"
01264DA6 PUSH SoulWork.01C795B8 ASCII "tb_Akashic_Make"
01264F0C PUSH SoulWork.01C795C8 ASCII "tb_Akashic_Parts"
012651DC PUSH SoulWork.01C795DC ASCII "tb_Akashic_Records"
0126587C PUSH SoulWork.01C795F0 ASCII "tb_Appearance"
01265AF6 PUSH SoulWork.01C79600 ASCII "tb_Aura"
@pushrbx
pushrbx / ws_soulworker.lua
Created October 19, 2018 20:55 — forked from x1nixmzeng/ws_soulworker.lua
Soul Worker Wireshark Dissector (packet analyser)
-- Soul Worker Wireshark Dissector rev 1
-- Written by WRS/x1nixmzeng (forum.xentax.com)
-- Usage: wireshark.exe -X lua_script:ws_soulworker.lua
local sw_port = 27017
sw_proto = Proto("sw_proto","Soul Worker Protocol")
local sw_method =
{
@pushrbx
pushrbx / gist:520f4c962eaef07416ebfd9caa2cfc2b
Created April 16, 2016 09:34
Razer Synapse stopped working: When right clicking on its icon in taskbar the coming up context menu freezes.
/// this gist about an issue with the razer synapse: Usually after windows update it doesn't come up ever again when you double
/// click on its icon. Also all the macros and key bindings stop working.
/// The invisible exception's stack trace is the following:
2016-01-04 19:05:33,575 [SynpaseMain::26620] DEBUG Razer.Emily.UI.SynapseApp [(null)] - DeviceMgr::Start
2016-01-04 19:05:33,580 [SynpaseMain::26620] DEBUG Razer.Emily.UI.AppEntryPoint [(null)] - SynapseMain::Failed
System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {7CC0C4B6-B68F-4141-9023-E3A189EDE86D} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipChe
@pushrbx
pushrbx / SpringNetContextMerge.cs
Created September 8, 2015 13:39
Spring.NET - Merge two application contexts. Extension methods.
public static void MergeWith(this AbstractApplicationContext targetContext,
AbstractApplicationContext sourceContext)
{
Check.NotNull(sourceContext, "sourceContext");
targetContext.Stop();
foreach (var definitionName in sourceContext.GetObjectDefinitionNames())
{
var definition = sourceContext.GetObjectDefinition(definitionName);
targetContext.RegisterObjectDefinition(definitionName, definition);