Skip to content

Instantly share code, notes, and snippets.

@delivrance
delivrance / ainput.py
Last active April 9, 2024 11:21
Python async input
import asyncio
from concurrent.futures import ThreadPoolExecutor
async def ainput(prompt: str = "") -> str:
with ThreadPoolExecutor(1, "AsyncInput") as executor:
return await asyncio.get_event_loop().run_in_executor(executor, input, prompt)
async def main():
@messa
messa / asyncio_ssl_example.py
Created June 26, 2015 12:43
Python asyncio + SSL TCP client/server example
#!/usr/bin/env python3
import asyncio
import multiprocessing
import os
import ssl
from time import sleep
port = 9000
@jpcaruana
jpcaruana / slocTags.sh
Created December 12, 2014 14:19
sloc over the tags
for tag in `git tag`
do
git co $tag
loc=`sloccount --duplicates --autogen --crossdups --wide --addlangall . | grep "Total Physical Source Lines of Code" | cut -d "=" -f2`
echo "$tag;$loc" >> tags.csv
done
@naholyr
naholyr / _service.md
Created December 13, 2012 09:39
Sample /etc/init.d script

Sample service script for debianoids

Look at LSB init scripts for more information.

Usage

Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
@MichaelBitard
MichaelBitard / 85-typematrix.rules
Last active September 27, 2017 09:22
TypeMatrix auto set dvorak mapping when usb is plugged in
ACTION=="add", ATTR{idProduct}=="2030", RUN+="/usr/bin/set_typematrix_dvorak_mapping"
@henrik
henrik / ocr.markdown
Created March 3, 2012 17:07
OCR on OS X with tesseract

Install ImageMagick for image conversion:

brew install imagemagick

Install tesseract for OCR:

brew install tesseract --all-languages

Or install without --all-languages and install them manually as needed.