Skip to content

Instantly share code, notes, and snippets.

View schittli's full-sized avatar

Tom-- schittli

  • Biel / Bienne, Switzerland
  • 07:09 (UTC +02:00)
View GitHub Profile
@jdhitsolutions
jdhitsolutions / UpDownPrompt.ps1
Last active January 15, 2020 20:08
A PowerShell prompt function using a synchronized hashtable and runspace to display server status (up/down).
function prompt {
$up = 0x25b2 -as [char]
$down = 0x25bc -as [char]
Try {
Get-Variable -Name testHash -Scope global -ErrorAction Stop | Out-Null
}
catch {
#create the runspace and synchronized hashtable
@jdhitsolutions
jdhitsolutions / Get-MyComics.ps1
Created October 5, 2018 16:54
A PowerShell script to download comic strips from the web and create an HTML "page".
#requires -version 5.0
[cmdletbinding()]
Param(
[Parameter(Position = 0, HelpMessage = "The path for the html file you want to create.")]
[ValidateNotNullOrEmpty()]
[string]$FilePath = "$env:temp\mycomics.html",
#Embed the comics into the HTML file, otherwise files will be linked
[switch]$Embed,
[switch]$Passthru
@park-brian
park-brian / AdvancedWindowSnap.ahk
Last active February 21, 2025 03:47 — forked from AWMooreCO/AdvancedWindowSnap.ahk
Advanced Window Snap is a script for AutoHotKey that expands upon Windows built-in window-snapping hotkeys.
/**
* Advanced Window Snap
* Snaps the active window to a position within a user-defined grid.
*
* @author Andrew Moore <[email protected]>
* @contributor jballi
* @contributor park-brian
* @contributor shinywong
* @version 1.2
*/
@jdhitsolutions
jdhitsolutions / Get-Qotd.ps1
Created September 26, 2018 20:54
A PowerShell function to get a quote of the day from BrainyQuote.com.
#requires -version 4.0
Function Get-QOTD {
<#
.Synopsis
Download quote of the day.
.Description
Using Invoke-RestMethod download the quote of the day from the BrainyQuote RSS feed. The URL parameter has the necessary default value.
.Example
@jerieljan
jerieljan / How I Do PlantUML.md
Last active March 20, 2025 15:40
PlantUML with Style -- How I do PlantUML

I use PlantUML a lot. It's what I use for drawing all sorts of diagrams and it's handy because of its easy markup (once you get used to it) while making things easy to maintain as projects grow (thanks to version control)

This gist explains how I do my PlantUML workspace in a project.

  • The idea is to keep a globals directory for all diagrams to follow (like the "stylesheet" below) to keep things consistent.
  • I use a stylesheet.iuml file that keeps the use of colors consistent through use of basic FOREGROUND, BACKGROUND and ACCENT colors.
  • The style-presets.iuml file defines these colors so you can make "presets" or "themes" out of them.
  • As stated in the stylesheet.iuml, you'll need the Roboto Condensed and Inconsolata fonts for these to work properly.
  • You can choose to either run the PlantUML jar over your file/s, or use an IDE like VSCode with the PlantUML extension. Here's a preview of example-sequence.puml for example: https://imgur.com/Klk3w2F
@ezra100
ezra100 / A.steps.md
Last active January 21, 2023 23:03
How to create CLD-3 libraries to use in your own project

How to create an independent shared library of cld-3

If you wanna use cld-3 in your project but don't want to keep depending on Ninja/gn build system then here's how I did it - on Linux (Arch 4.16.13-1) and g++.

Disclaimer:

I'm not an expert on this topic, this is just how I (finally) managed to do it, not necessarily the best way to do it (esp. with the STD compatibility). if you have any suggestions about how to do it better let me know.

Static vs Shared Library

The benefit of a shared library is that you can copy it for wherever you want and use if from there, as for the static - I found out you can't move it, unless you move the whole out/Debug folder (or maybe just the out/Debug/obj folder, I'm not quite sure). There might be some differences in the performence, but they say it isn't significant.

Steps to create a shared/static library

@UweKeim
UweKeim / convert-wildcards-to-regex.cs
Last active January 28, 2024 21:32
Convert wildcards to Regular Expressions.
private static string convertWildcardToRegex(string pattern)
{
// http://stackoverflow.com/a/6907849/107625
// http://www.codeproject.com/Articles/11556/Converting-Wildcards-to-Regexes
return "^" + Regex.Escape(pattern).
Replace("\\*", ".*").
Replace("\\?", ".") + "$";
}
@nobusugi246
nobusugi246 / gitlab-api.ps1
Last active December 5, 2024 17:10
GitLab API with PowerShell.
# https://docs.gitlab.com/ee/api/projects.html
# https://docs.gitlab.com/ee/api/issues.html
# https://docs.gitlab.com/ee/api/notes.html
# Project List
$r = Invoke-RestMethod -Headers @{ 'PRIVATE-TOKEN'='xxxxx' } -Uri http://xxxxx/api/v4/projects/
$r | Sort-Object -Property id | Format-Table -Property id, name
# Issues List
$r = Invoke-RestMethod -Headers @{ 'PRIVATE-TOKEN'='xxxxx' } -Uri http://xxxxx/api/v4/projects/<xx>/issues
Add-Content $profile -Value (iwr https://goo.gl/MX4F3v); . $Profile
using namespace System.Management.Automation
using namespace System.Collections.Generic
class ArgumentCompleterBase : IArgumentCompleter {
hidden [List[CompletionResult]] $Results = [List[CompletionResult]]::new()
[string] $WordToComplete
[Language.CommandAst] $commandAst
# override in child class
[void] AddCompletionsFor([string] $commandName, [string] $parameterName, [Collections.IDictionary] $fakeBoundParameters) {}