Skip to content

Instantly share code, notes, and snippets.

Avatar
💬
(∪.∪ )...zzz

HRXN Hrxn

💬
(∪.∪ )...zzz
View GitHub Profile
@Hrxn
Hrxn / pwsh-EnvPaths.psm1
Last active Jun 23, 2022
PowerShell: module for the PATH system environment variable
View pwsh-EnvPaths.psm1
# PowerShell Module File
# Name: EnvPaths.psm1
# Desc: Module for handling of the 'Path' system environment variable
# Source: https://gist.github.com/Hrxn/57c83ab93d642bdd868f97355f3aab45; Based on: https://gist.github.com/mkropat/c1226e0cc2ca941b23a9
function Add-EnvPath {
param(
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[System.String] $Path,
@Hrxn
Hrxn / wmi-rebuild.md
Created May 22, 2019
Windows: Rebuilding the WMI repository on Windows
View wmi-rebuild.md

Rebuild the WMI Repository

The WMI error can be due to a corrupted WMI repository folder. As such, rebuilding the WMI repository might also fix the Windows Management Instrumentation error. This is how you can rebuild the WMI repository.

  • Open the Command Prompt as administrator by selecting Command Prompt (Admin) on the Win + X menu.
  • Enter ‘net stop winmgmt’ in the Prompt, and press the Enter key.
  • Press the Windows key + R keyboard shortcut.
  • Input ‘System32’ in Run, and press the OK button.
  • Then open the wbem subfolder that’s in the System32 folder.
  • Right-click the Repository folder and select Rename.
@Hrxn
Hrxn / EnvPaths.psm1
Created Dec 15, 2018 — forked from mkropat/EnvPaths.psm1
Pwsh: Module for Path Environment Variable
View EnvPaths.psm1
function Add-EnvPath {
param(
[Parameter(Mandatory=$true)]
[string] $Path,
[ValidateSet('Machine', 'User', 'Session')]
[string] $Container = 'Session'
)
if ($Container -ne 'Session') {
@Hrxn
Hrxn / tumblr_info.py
Created Jun 4, 2018
Python: Tumblr Stats Info
View tumblr_info.py
import argparse, time, re
import pytumblr
ap = argparse.ArgumentParser(description='tumblr.py: Process a text file of Tumblr Blog URLs.')
ap.add_argument('input_file', metavar='FILE', type=str, help='specifies the text file to process')
ap.add_argument('-v', '--values', action='store_true', help='prints only the user-ids in FILE')
args = ap.parse_args()
# Use your account credentials here for API access (OAuth)
client = pytumblr.TumblrRestClient(
@Hrxn
Hrxn / instagram_profile_stats.py
Last active Jun 2, 2018
Python: Web Scraping
View instagram_profile_stats.py
from requests_html import HTMLSession
import re
session = HTMLSession()
out_header = ('URL' + ';' + 'Account Name' + ';' + 'Displayed Full Name' + ';' + 'Submitted Posts'
+ ';' + 'Followers' + ';' + 'Postcount (Number)')
sel_handle = '#react-root > section > main > div > header > section > div:nth-of-type(1) > h1'
sel_iposts = '#react-root > section > main > div > header > section > ul > li:nth-child(1) > span'
View keybase.md

Keybase proof

I hereby claim:

  • I am hrxn on github.
  • I am hrxn (https://keybase.io/hrxn) on keybase.
  • I have a public key ASCbz3FnwAPQlEPZkxcPZX0ITbRz0Pt5MLjioH9OW3loqQo

To claim this, I am signing this object:

@Hrxn
Hrxn / filesize.py
Created Jun 21, 2017 — forked from kingychiu/filesize.py
Python script finding all files with file size which is multiple of 4096.
View filesize.py
# Bug report: https://bugs.chromium.org/p/chromium/issues/detail?id=720597&can=2&start=0&num=100&q=&colspec=ID%20Pri%20M%20Stars%20ReleaseBlock%20Component%20Status%20Owner%20Summary%20OS%20Modified&groupby=&sort=
# Description: https://tinyio.wordpress.com/2017/06/17/solving-this-extension-may-have-been-corrupted-in-chrome-version-59/
import os
import glob
size_dir = {}
for filename in glob.iglob('./**/*.*', recursive=True):
size =os.path.getsize(filename)
if size % 4096 == 0 and size != 0:
size_dir[filename] = os.path.getsize(filename)
@Hrxn
Hrxn / example-1.cmd
Last active Nov 5, 2016
CMD: Examples for PUSHD and POPD
View example-1.cmd
---------------------------------------------------------------------------------
:: 1
@echo off
PUSHD .
CD /D %AppData%\example
MD sub
CD /D E:\Test\files\xdir
COPY /Y file.ext %AppData%\example\sub\file.ext
POPD
@Hrxn
Hrxn / switch-tscale.lua
Last active Jun 19, 2019
mpv: lua script usage
View switch-tscale.lua
-- Loading lua scripts in mpv:
-- 1: Scripts passed to the --script option
-- --script /path/to/script
-- 2: scripts subdirectory of the mpv configuration directory
-- ~/.config/mpv/scripts/
--
local interp_changed = true
function toggle_interp()
if interp_changed then
@Hrxn
Hrxn / show-cmd-context.reg
Last active Jul 7, 2021
Always show the 'Open Command Prompt' option in Windows context menu
View show-cmd-context.reg
Windows Registry Editor Version 5.00
; Always shows the CMD option (Open Command Prompt) in context menu
; No need for the Shift key anymore
; Removes the 'Extended' keyword from ../shell/cmd
[HKEY_CLASSES_ROOT\Drive\shell\cmd]
"Extended"=-
[HKEY_CLASSES_ROOT\Directory\shell\cmd]