Skip to content

Instantly share code, notes, and snippets.

View jasonhdavis's full-sized avatar

Jason jasonhdavis

View GitHub Profile
@sourceperl
sourceperl / client.py
Last active March 18, 2022 20:22
Simple key/value store with json and python flask
#!/usr/bin/env python3
import http.client
import json
connection = http.client.HTTPConnection('localhost', port=5000)
headers = {'Content-type': 'application/json'}
connection.request('GET', '/set/foo?value=474', headers=headers)
response = connection.getresponse().read()
@durden
durden / sanitize.py
Last active April 26, 2023 11:13
Different ways to 'sanitize' a list of strings to ensure they don't contain any of the contents of another 'ignored' list
"""
Demonstration of ways to implement this API:
sanitize(unsanitized_input, ignored_words)
Related discussions:
- Modifying a list while looping over it:
- http://stackoverflow.com/questions/1207406/remove-items-from-a-list-while-iterating-in-python
- Remove all occurences of a value in a list:
- http://stackoverflow.com/questions/1157106/remove-all-occurences-of-a-value-from-a-python-list