Skip to content

Instantly share code, notes, and snippets.

View GhostOps77's full-sized avatar
🔴
Not Available

Ghost Ops GhostOps77

🔴
Not Available
  • Somewhere in a Dark place
View GitHub Profile
from __future__ import annotations
import os
from prompt_toolkit.formatted_text import FormattedText, StyleAndTextTuples
class TokenizedFormattedText(FormattedText):
__slots__ = ("parent_token_class",)
def __init__(self, tokens_list: StyleAndTextTuples, parent_token_class: str) -> None:
is_not_formatted_text = not isinstance(
tokens_list, (TokenizedFormattedText, FormattedText)
using namespace System.Management.Automation
using namespace System.Management.Automation.Language
using namespace Microsoft.PowerShell.PSConsoleReadLine
if ($host.Name -eq 'ConsoleHost') {
Import-Module PSReadLine
}
Import-Module -Name Terminal-Icons
@GhostOps77
GhostOps77 / oh-my-posh-config.json
Last active January 28, 2024 15:19
My oh-my-posh config
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"version": 2,
"final_space": true,
"var": {
"shell_icons": {
"pwsh": "",
"cmd": "",
"bash": "",
"zsh": "%_",
@GhostOps77
GhostOps77 / grab-youtube-channel-id.py
Last active December 31, 2022 13:59
This Python code can get you the channel ID of someone's channel just from the url of their channel, or one of their videos
# This Python code can get you the channel ID of anybody's YT channel
# Just either from the url from one of their videos, their channel, playlists, etc.
# Requires aiohttp (for asychronous requests)
from aiohttp import ClientSession
import asyncio
import re
@GhostOps77
GhostOps77 / grab-anchor-episode.sh
Created November 16, 2022 14:06 — forked from ivan/grab-anchor-episode.sh
Download a podcast episode from anchor.fm
#!/usr/bin/env bash
# Download a podcast episode from anchor.fm
#
# Usage:
# grab-anchor-episode "https://anchor.fm/emerge/episodes/Robert-MacNaughton---Learnings-from-the-Life-and-Death-of-the-Integral-Center-e31val" # (m4a example)
# grab-anchor-episode "https://anchor.fm/free-chapel/episodes/Are-You-Still-In-Love-With-Praise--Pastor-Jentezen-Franklin-e19u4i8" # (mp3 example)
#
# anchor.fm serves a list of m4a or mp3 files that need to be concatenated with ffmpeg.
#
@GhostOps77
GhostOps77 / int_to_roman_number.py
Last active March 19, 2022 13:49
A sample code that can convert Integer to Roman numeral in Python (not the fastest, but still it works; kind of)
def int_to_roman_num(number:int) -> str:
num, string, lst = str(number)[::-1], 'IVXLCDM', []
for index, val in enumerate(map(int, num)):
if val == 0: continue
(q, r), index2 = divmod(val, 5), index*2
if val in (4, 9):
temp = f'{string[index2]}{string[index2+q+1]}'
else:
temp = f'{string[index2+q]*q}{string[index2]*r}'