Skip to content

Instantly share code, notes, and snippets.

@xcud
xcud / Get-Rights.ps1
Last active August 29, 2015 14:09
Get-Rights
$source = @"
using System;
using System.Runtime.InteropServices;
using System.Security.Principal;
using System.Text;
using System.Collections.Generic;
public static class ADPermissions {
public static string[] EnumRights()
{
@xcud
xcud / IsImage
Created January 29, 2015 06:55
Quickly determine whether a given path is an image
public static bool IsImage(string path)
{
Dictionary<string, string[]> knownImageHeaders = new Dictionary<string, string[]>()
{
{"jpg", new [] { "FF", "D8" } },
{"bmp", new [] { "42", "4D" } },
{"gif", new [] { "47", "49", "46" } },
{"tif", new [] { "49", "49", "2A" } },
{"png", new [] { "89", "50", "4E", "47", "0D", "0A", "1A", "0A" } },
};
@xcud
xcud / lessons-learned.md
Last active August 17, 2017 03:02
Lessons Learned by Eric Schmidt transcribed by Abheek Anand

Lessons Learned – The Hard Way Eric Schmidt, E&VC Final Class Transcribed by Abheek Anand

About Management Culture:

  • You get personal leverage through delegation and empowerment, along with inspection
  • Hiring defines a company. Review every job offer every time.
  • Manager (or teams reporting to a manager) should never have the unilateral authority to hire people.
  • Major decisions should be made in large groups, by two joint owners.
  • Be careful about goal-misalignment; goaling drives behavior and conflict.

Keybase proof

I hereby claim:

  • I am xcud on github.
  • I am xcud (https://keybase.io/xcud) on keybase.
  • I have a public key whose fingerprint is 7BA8 6448 F6D1 3723 C179 A1E8 B6D3 B627 C518 10F7

To claim this, I am signing this object:

### Keybase proof
I hereby claim:
* I am xcud on github.
* I am xcud (https://keybase.io/xcud) on keybase.
* I have a public key whose fingerprint is 3639 68AF 7B4C 85CA 8188 6F73 AFAE A77A 020D FE73
To claim this, I am signing this object:
@xcud
xcud / cat_mode.sh
Created May 30, 2025 16:10
A bash script to quickly disable your laptop keyboard when your cat decides to sit on it while you're using an external keyboard. Make it executable: `chmod +x cat_mode.sh`, bind it to an F key, adjust keyboard ID (run xinput list to find yours)
#!/bin/bash
# Cat Mode Toggle Script
# Detects current state and toggles between enabled/disabled keyboard
KEYBOARD_ID=28
MASTER_ID=3
TIMER_PID_FILE="/tmp/keyboard_timer_pid"
# Function to check if keyboard is currently floating (disabled)