Skip to content

Instantly share code, notes, and snippets.

@jlumbroso
jlumbroso / diff_side_by_side.py
Created May 8, 2022 02:18
Side-by-Side Diff Comparison in Python
# Code licensed LGPLv3 by Jérémie Lumbroso <lumbroso@cs.princeton.edu>
import difflib
import itertools
import textwrap
import typing
def side_by_side(
left: typing.List[str],
@Snarp
Snarp / google-docs-copy.js
Last active May 8, 2024 21:05
Script to allow copying from a protected Google Doc
/*
<https://stackoverflow.com/questions/40296831/is-it-possible-to-force-a-copy-of-a-protected-google-doc>
NOTE - 2021-05-24
-----------------
The script below isn't the fastest way to copy-and-paste from a protected
Google Doc. Before trying it, I'd suggest following MikoFrosty's advice from
the comments:

软路由

@danrovito
danrovito / countrydropdown.html
Last active May 8, 2024 21:03
HTML Country Select Dropdown List
<label for="country">Country</label><span style="color: red !important; display: inline; float: none;">*</span>
<select id="country" name="country" class="form-control">
<option value="Afghanistan">Afghanistan</option>
<option value="Åland Islands">Åland Islands</option>
<option value="Albania">Albania</option>
<option value="Algeria">Algeria</option>
<option value="American Samoa">American Samoa</option>
<option value="Andorra">Andorra</option>
<option value="Angola">Angola</option>
@willeccles
willeccles / sockets.h
Last active May 8, 2024 21:01
Cross-platform socket header for both POSIX sockets and Winsock
/*
* File: sockets.h
* Author: Will Eccles
* Date: 2020-03-12
*
* 1. Description
*
* This header attempts to make it easy to use sockets across platforms,
* for both Windows and POSIX systems. While Winsock is often somewhat
* compatible with Berkeley sockets, it is not strictly compatible,
@Insighttful
Insighttful / us_postal_address_parse_expand.py
Last active May 8, 2024 21:00
Provides US Postal address parsing and street type expansion using Python usaddress and rapidfuzz packages.
#!/usr/bin/env python3.11
"""
MIT License
For the full text of the MIT License, please visit:
https://opensource.org/licenses/MIT
"""
"""
@EdwinChan
EdwinChan / nested.py
Last active May 8, 2024 20:58
Trick for using multiprocessing with nested functions and lambda expressions
import concurrent.futures
import multiprocessing
import sys
import uuid
def globalize(func):
def result(*args, **kwargs):
return func(*args, **kwargs)
result.__name__ = result.__qualname__ = uuid.uuid4().hex
setattr(sys.modules[result.__module__], result.__name__, result)
@Blackshome
Blackshome / sensor-light.yaml
Last active May 8, 2024 20:57
Home Assistant Sensor Light that can be used in Blueprints
blueprint:
name: Sensor Light
description: >
# 💡 Sensor Light
**Version: 6.5**
Your lighting experience, your way - take control and customize it to perfection! 💡✨
@butageek
butageek / windows_activation.md
Last active May 8, 2024 20:55
Activate Windows for free

For Windows 10

Step 1 - Open PowerShell or Command Prompt as administrator

Step 2 - Install KMS client key

slmgr /ipk your_license_key

Replace your_license_key with following volumn license keys according to Windows Edition: