Skip to content

Instantly share code, notes, and snippets.

@phaufe
phaufe / wordle.md
Created February 2, 2022 09:22 — forked from huytd/wordle.md
Wordle in less than 50 lines of Bash

image

How to use:

./wordle.sh

Or try the unlimit mode:

@phaufe
phaufe / MinimalAPIs.md
Created September 13, 2021 14:56 — forked from davidfowl/MinimalAPIs.md
Minimal APIs at a glance
@phaufe
phaufe / earthquakes-to-sqlite.ipynb
Created July 23, 2021 10:06 — forked from simonw/earthquakes-to-sqlite.ipynb
Using Datasette with Jupyter to publish your data - JupyterCon 2020 - rendered here: https://nbviewer.jupyter.org/gist/simonw/656c21b5800d5e4624dec9930f00e093
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@phaufe
phaufe / music_theory.py
Created April 20, 2021 11:05 — forked from mvanga/music_theory.py
Basic Music Theory in ~200 Lines of Python
# The code for my article with the same name. You can find it at the URL below:
# https://www.mvanga.com/blog/basic-music-theory-in-200-lines-of-python
# MIT License
#
# Copyright (c) 2021 Manohar Vanga
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
using System;
using System.Collections.Generic;
using System.Linq;
namespace [YOURNAMESPACEHERE]
{
public static class TypeExtensions
{
public static bool IsDerivingFrom(this Type type, Type searchType)
@phaufe
phaufe / Crc64.cs
Created April 9, 2020 16:55 — forked from maxpert/Crc64.cs
CRC64 implementation C#
public class Crc64
{
private static readonly ulong[] Table = {
0x0000000000000000, 0x7ad870c830358979,
0xf5b0e190606b12f2, 0x8f689158505e9b8b,
0xc038e5739841b68f, 0xbae095bba8743ff6,
0x358804e3f82aa47d, 0x4f50742bc81f2d04,
0xab28ecb46814fe75, 0xd1f09c7c5821770c,
0x5e980d24087fec87, 0x24407dec384a65fe,
0x6b1009c7f05548fa, 0x11c8790fc060c183,
@phaufe
phaufe / chrome_demonstration.py
Created April 8, 2019 11:47 — forked from LPX55/chrome_demonstration.py
Extracting Chrome Passwords with Python | Demonstration for hackernoon.com/@HanYoon
# os and sqlite3 ships with Python by default. If you get import errors for win32crypt use "pip install pypiwin32" to install the dependency.
import os, sqlite3, win32crypt
# Automatically get the logged in user's default folder
data = os.path.expanduser('~')+"\AppData\Local\Google\Chrome\User Data\Default\Login Data"
# Connect to Login Data database
connection = sqlite3.connect(data)
cursor = connection.cursor()
@phaufe
phaufe / gist:e6740155698d28fb72e1894bd5efd686
Created April 3, 2019 15:55 — forked from rsgoheen/gist:ba5fb610396b09e4481e
Using Serilog in a PowerShell script
Add-Type -Path "Serilog.dll"
Add-Type -Path "Serilog.Sinks.Seq.dll"
Add-Type -Path "Serilog.Sinks.EventLog.dll"
Add-Type -Path "Serilog.FullNetFx.dll"
Add-Type -Path "Serilog.Extras.AppSettings.dll"
Add-Type -Path "Serilog.Extras.Timing.dll"
$Config = New-Object Serilog.LoggerConfiguration
[Serilog.Configuration.LoggerSinkConfiguration]$ConfigSink = $config.WriteTo
[Serilog.Log]::Logger = [Serilog.LoggerConfigurationFullNetFxExtensions]::RollingFile($ConfigSink, "C:\Logs\Log-{Date}.txt", ([Serilog.Events.LogEventLevel]::Verbose), "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level}] {Message}{NewLine}{Exception}", $null, 10000000, 15).CreateLogger()
@phaufe
phaufe / logger.ps1
Created March 28, 2019 09:21 — forked from barsv/logger.ps1
Logging in powershell with log rotation
# all logging settins are here on top
$logFile = "log-$(gc env:computername).log"
$logLevel = "DEBUG" # ("DEBUG","INFO","WARN","ERROR","FATAL")
$logSize = 1mb # 30kb
$logCount = 10
# end of settings
function Write-Log-Line ($line) {
Add-Content $logFile -Value $Line
Write-Host $Line
@phaufe
phaufe / Start-FileSystemWatcher.ps1
Created March 28, 2019 07:55 — forked from mobzystems/Start-FileSystemWatcher.ps1
Using a FileSystemWatcher from PowerShell
# Start-FileSystemWatcher.ps1 - File System Watcher in Powershell.
# Brought to you by MOBZystems, Home of Tools
# https://www.mobzystems.com/code/using-a-filesystemwatcher-from-powershell/
[CmdletBinding()]
Param(
# The path to monitor
[Parameter(Mandatory=$true, Position=0)]
[string]$Path,
# Monitor these files (a wildcard)