Skip to content

Instantly share code, notes, and snippets.

@xpn
xpn / LAPSDecrypt.cs
Last active October 11, 2024 18:16
Quick POC looking at how encryption works for LAPS (v2)
using System;
using System.Collections.Generic;
using System.DirectoryServices.Protocols;
using System.Globalization;
using System.Linq;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.ComTypes;
using System.Security.Policy;
using System.Security.Principal;
using System.Text;
@vi
vi / get_github_stars.sh
Last active October 28, 2022 09:38
Hacky workaround to track new stars of your repositoes (previously displayed on Github home page)
#!/bin/bash
set -e
TOKEN=...
USERNAME=...
D=$(mktemp -d)
cd "$D"
P=1
@jborean93
jborean93 / get_microsoft_updates.py
Last active March 11, 2025 13:49
Cross platform way to search for and download updates listed in the Microsoft Update catalog
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright: (c) 2019, Jordan Borean (@jborean93) <[email protected]>
# MIT License (see LICENSE or https://opensource.org/licenses/MIT)
# Script to search for updates in the Microsoft Update Catalog. Works on both Python 2 and 3 but requires BeautifulSoup
# to be installed - https://www.crummy.com/software/BeautifulSoup/#Download
import contextlib
import datetime
@b0c0de
b0c0de / css-3d-disco-ball.markdown
Created November 20, 2019 03:36
CSS 3D Disco Ball
@groz
groz / sync-http.swift
Created February 15, 2018 22:29
Synchronous http request in Swift
import Foundation
func query(address: String) -> String {
let url = URL(string: address)
let semaphore = DispatchSemaphore(value: 0)
var result: String = ""
let task = URLSession.shared.dataTask(with: url!) {(data, response, error) in
result = String(data: data!, encoding: String.Encoding.utf8)!
@lightrush
lightrush / README.md
Created November 3, 2017 05:18
X11vnc Systemd Unit File

X11vnc Systemd Unit File

This Systemd unit file starts X11VNC on boot

  1. Set VNC password: sudo x11vnc -storepasswd [YOUR VNC PASSWORD] /etc/x11vnc.passwd
  2. Install Systemd Unit File
sudo cp [path to]/vnc.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable vnc.service
@pudquick
pudquick / last.py
Last active July 26, 2024 08:19
Parsing utmp/utmpx record entries for login, logout, shutdown and reboot on macOS with python and ctypes
from ctypes import CDLL, Structure, POINTER, c_int64, c_int32, c_int16, c_char, c_uint32
from ctypes.util import find_library
import time
c = CDLL(find_library("System"))
# https://opensource.apple.com/source/Libc/Libc-1158.50.2/include/NetBSD/utmpx.h.auto.html
# https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man3/endutxent.3.html#//apple_ref/doc/man/3/endutxent
BOOT_TIME = 2
@Mostafa-Hamdy-Elgiar
Mostafa-Hamdy-Elgiar / Filetimes.py
Created February 25, 2017 09:22
Python Script to convert Microsoft widows file time to python date and also date to windows file time
#!/usr/bin/env python
# Copyright (c) 2009, David Buxton <[email protected]>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
@bluebat
bluebat / menu.ipxe
Created October 20, 2016 07:55
Menu script for iPXE
#!ipxe
menu Selection
item liveins-freedos-1.0 FreeDOS 1.0 (ro)
item livesys-fdos-1.1 FDOS 1.1 (ro)
item liveiso-slitaz-current Slitaz current (ro)
item liveiso-tinycore-7.2 TinyCore 7.2 (ro)
item netsys-fedora-23 Fedora 23 (rw)
item netsys-korora-24 Korora 24 (rw)
choose os && goto ${os}
@groundrace
groundrace / webcryptoapi.html
Created April 13, 2016 23:56 — forked from deiu/webcryptoapi.html
Web Crypto API: RSA keygen & export & import & sign & verify & encrypt & decrypt
<html>
<head>
<script>
function generateKey(alg, scope) {
return new Promise(function(resolve) {
var genkey = crypto.subtle.generateKey(alg, true, scope)
genkey.then(function (pair) {
resolve(pair)
})
})