Version: 1.0.0 Protocol Version: 2024-11-05 Last Updated: 2026-01-10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| help: | |
| @echo '' | |
| @echo 'Usage:' | |
| @echo ' make [target]' | |
| @echo '' | |
| @echo 'Targets:' | |
| @awk '/^[a-zA-Z\-\_0-9]+:/ { \ | |
| helpMessage = match(lastLine, /^# (.*)/); \ | |
| if (helpMessage) { \ | |
| helpCommand = substr($$1, 0, index($$1, ":")-1); \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Requirements: pip install flask gevent gunicorn requests structlog | |
| # gunicorn -w 3 -t 5 -k gevent -b 0.0.0.0:11111 --keep-alive 10 app:app | |
| import signal | |
| import requests | |
| import structlog | |
| from flask import Flask | |
| logger = structlog.get_logger() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env zsh | |
| typeset -a lines | |
| typeset -i prev_time=0 | |
| typeset prev_command | |
| while read line; do | |
| if [[ $line =~ '^.*\+([0-9]{10})\.([0-9]{6})[0-9]* (.+)' ]]; then | |
| integer this_time=$match[1]$match[2] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from bs4 import BeautifulSoup | |
| def contains_html(s): | |
| return bool(BeautifulSoup(s, "html.parser").find()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #![feature(core_intrinsics)] | |
| fn print_type_of<T>(_: &T) { | |
| println!("{}", unsafe { std::intrinsics::type_name::<T>() }); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| redis-cli KEYS "prefix:*" | xargs redis-cli DEL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from wtforms import fields | |
| import json | |
| class JSONField(fields.StringField): | |
| def _value(self): | |
| return json.dumps(self.data) if self.data else '' | |
| def process_formdata(self, valuelist): | |
| if valuelist: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def unique_pairs(n): | |
| """Produce pairs of indexes in range(n)""" | |
| for i in range(n): | |
| for j in range(i+1, n): | |
| yield i, j | |
| s = "a string to examine" | |
| for i, j in unique_pairs(len(s)): | |
| if s[i] == s[j]: | |
| answer = (i, j) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |
NewerOlder