Skip to content

Instantly share code, notes, and snippets.

@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:

@wojteklu
wojteklu / clean_code.md
Last active May 8, 2024 20:54
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@BretFisher
BretFisher / Dockerfile
Last active May 8, 2024 20:53
Multi-stage Dockerfile example of installing dependencies with COPY --from
# any images you use later, add them here first to create aliases
# I like keeping all my versions at the top
FROM node:14.3-slim as node
FROM php:7.2.1-fpm-slim as php
FROM nginx:1.17 as nginx
# The real base image to start from
FROM ubuntu:focal-20210827 as base
# install apt stuff
@rxaviers
rxaviers / gist:7360908
Last active May 8, 2024 20:51
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: πŸ˜„ :smile: πŸ˜† :laughing:
😊 :blush: πŸ˜ƒ :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
πŸ˜† :satisfied: 😁 :grin: πŸ˜‰ :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: πŸ˜€ :grinning:
πŸ˜— :kissing: πŸ˜™ :kissing_smiling_eyes: πŸ˜› :stuck_out_tongue:
@nicolasdao
nicolasdao / terminal_emojis.md
Last active May 8, 2024 20:51
Terminal emojis. Keywords: terminal console symbol emoji emoticon icon
Emoji Name Text example
πŸš€ Rocket You're up
πŸ“¦ Package Installing additional dependencies...
βš“ Hook Running completion hooks...
πŸ“„ Document Generating README.md...
πŸŽ‰ Party Successfully created project hello-vue.
πŸ‘‰ Next Get started with the following commands:
βœ” Tick Task completed
✨ Magic Assembling project...
@leoluk
leoluk / journal-reactor.py
Created October 3, 2018 22:19
Example code that demonstrates how to listen to journald using Python 3 + asyncio.
#!/usr/bin/python3 -u
import asyncio
import sh
from systemd import journal
from systemd.daemon import notify
GATEWAY_IP = "192.168.10.1"