Skip to content

Instantly share code, notes, and snippets.

View gerrited's full-sized avatar
🧐
Greetings!

Gerrit Edzards gerrited

🧐
Greetings!
View GitHub Profile
@gerrited
gerrited / GetHashCode32.cs
Last active November 7, 2017 02:48
Microsoft messed up the 64 bit version of GetHashCode. This is a platform independent port of the 32 bit version of Object.GetHashCode based on the unsafe code of Yoni Toledano on StackOverflow (http://stackoverflow.com/a/835571/2132050)
public static class StringExt
{
public static int GetHashCode32(this string s)
{
var chars = s.ToCharArray();
var lastCharInd = chars.Length - 1;
var num1 = 0x15051505;
var num2 = num1;
var ind = 0;
while (ind <= lastCharInd)
@gerrited
gerrited / RedrawSuspender.cs
Last active September 3, 2015 14:22
Fix this flickering behaviour of old Win32 controls. The code is based on a discussion on StackOverflow http://stackoverflow.com/questions/487661/how-do-i-suspend-painting-for-a-control-and-its-children
public static class ControlExtensions
{
public static IDisposable GetRedrawSuspender(this Control cuntrol) { return new RedrawSuspender(cuntrol); }
}
public class RedrawSuspender : IDisposable
{
private Control _control;
internal RedrawSuspender(Control control)

Keybase proof

I hereby claim:

  • I am gerrited on github.
  • I am gerrited (https://keybase.io/gerrited) on keybase.
  • I have a public key whose fingerprint is 0DAE 5EE0 349C 9CE0 D317 9E33 F0B9 5B14 F0C7 C3EE

To claim this, I am signing this object:

apiVersion: apps/v1
kind: Deployment
metadata:
name: hello-blinkt
labels:
app: hello-blinkt
spec:
replicas: 16
selector:
matchLabels:
@gerrited
gerrited / gist:cd24bbd295dbb8c6209993f77e4e9e0d
Last active June 5, 2024 18:28 — forked from gerrit-amagno/gist:07d75a94fca2b6683f3ecfe8f7c9071d
create a short link with is.gd and copy it to the clipboard - powershell function for notepad $profile - add quotes for the url parameter when calling the function
function short {
param([string]$url)
$escapedUrl = [URI]::EscapeUriString($url)
$shorturl = curl "https://is.gd/create.php?format=simple&url=$escapedUrl"
Write-Output $shorturl
Set-Clipboard $shorturl
}
@gerrited
gerrited / gist:9ab37487ef0750048440f7be00672136
Created February 26, 2024 10:10 — forked from gerrit-amagno/gist:c18c923f280c2886a34bc6572a9e2cac
git add, commit and push - powershell function for notepad $PROFILE
function acp {
param([string]$mes = "Small changes")
git add .
git commit -m $mes
git push
}