Skip to content

Instantly share code, notes, and snippets.

@yushiyangk
yushiyangk / Regular expressions for Python built-in types.md
Last active May 19, 2024 06:07
Regular expressions for Python built-in types

Regular expressions for Python built-in types

bool_pattern = ".*"
int_pattern = r"[+-]?(?:[0-9]|[0-9][0-9_]*[0-9])"
float_numeric_pattern = r"[+-]?(?:[0-9]\.?|[0-9][0-9_]*[0-9]\.?|(?:[0-9]|[0-9][0-9_]*[0-9])?\.(?:[0-9]|[0-9][0-9_]*[0-9]))(?:[eE][+-](?:[0-9]|[0-9][0-9_]*[0-9]))?"
float_pattern = r"[+-]?(?:(?:[0-9]\.?|[0-9][0-9_]*[0-9]\.?|(?:[0-9]|[0-9][0-9_]*[0-9])?\.(?:[0-9]|[0-9][0-9_]*[0-9]))(?:[eE][+-](?:[0-9]|[0-9][0-9_]*[0-9]))?|[iI][nN][fF](?:[iI][nN][iI][tT][yY])?|[nN][aA][nN])"

Expanded

Useful when using python -c 'python_script' as part of a larger task/shell script.

These one-liners will exit with exit code 1 if "no" is chosen.

Reprompt for invalid inputs

Default "yes"

@ddemidov
ddemidov / Makefile
Created June 13, 2012 18:38
Hello world in OpenCL
hello: hello.cpp
g++ -std=c++0x -o hello hello.cpp -lOpenCL
@Blackshome
Blackshome / appliance-notifications.yaml
Last active May 19, 2024 06:05
appliance-notifications.yaml
blueprint:
name: Appliance Notifications & Actions
description: >
# 📳 Appliance Notifications & Actions
**Version: 2.0**
🤔 Watts your appliance up to, you're always in the know from start to finish!🛎️🔌💸
@osipxd
osipxd / !paper-versions.md
Last active May 19, 2024 06:03
Paper versions links
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Custom Scrollbar Windows 95 Style</title>
<style>
body {
margin: 0;
font-family: Arial, sans-serif;
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Custom Scrollbar Windows 95 Style</title>
<style>
body {
margin: 0;
font-family: Arial, sans-serif;
@terabyte
terabyte / amazon.md
Created December 6, 2017 02:27
Amazon's Build System

Prologue

I wrote this answer on stackexchange, here: https://stackoverflow.com/posts/12597919/

It was wrongly deleted for containing "proprietary information" years later. I think that's bullshit so I am posting it here. Come at me.

The Question

Amazon is a SOA system with 100s of services (or so says Amazon Chief Technology Officer Werner Vogels). How do they handle build and release?

@mike-myers-tob
mike-myers-tob / Working GDB on macOS 11.md
Last active May 19, 2024 06:00
Steps to get GDB actually working in April 2021 on macOS (Intel x86-64 only)

Debug with GDB on macOS 11

The big reason to do this is that LLDB has no ability to "follow-fork-mode child", in other words, a multi-process target that doesn't have a single-process mode (or, a bug that only manifests when in multi-process mode) is going to be difficult or impossible to debug, especially if you have to run the target over and over in order to make the bug manifest. If you have a repeatable bug, no big deal, break on the fork from the parent process and attach to the child in a second lldb instance. Otherwise, read on.

Install GDB

Don't make the mistake of thinking you can just brew install gdb. Currently this is version 10.2 and it's mostly broken, with at least two annoying bugs as of April 29th 2021, but the big one is https://sourceware.org/bugzilla/show_bug.cgi?id=24069

$ xcode-select install  # install the XCode command-line tools
@NullDev
NullDev / 1-discord-cli.md
Last active May 19, 2024 05:59
Some Discord console tricks

Discord Console Tricks (Experiments, Dev Stuff, etc)

INSTRUCTIONS FOR ALL OF THEM:

  • Open DevTools in Discord with CTRL + SHIFT + i (ONLY POSSIBLE IN CANARY AND PBT ANYMORE)
  • Paste Snippet
  • Edit it. (optional: if instructed)
  • Hit Enter.

Enable Experiments and Dev-Only Options: