Skip to content

Instantly share code, notes, and snippets.

@bsolomon1124
bsolomon1124 / toggle_password.html
Created January 11, 2020 17:17
Toggle <input type="password"> visibility via jQuery
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8">
<title>Toggle Password Visibility Demo</title>
<script
src="https://code.jquery.com/jquery-3.4.1.min.js"
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo="
crossorigin="anonymous"></script>
</head>
@bsolomon1124
bsolomon1124 / forms.py
Created January 9, 2020 14:05
Derivative of SimpleArrayField
"""Reproduce SplitArrayField for no-psycopg2 environment.
See:
- 1.11.x/django/contrib/postgres/forms/array.py
- 1.11.x/django/forms/fields.py
- 1.11/ref/contrib/postgres/forms/
- 1.11/ref/forms/validation/
"""
@bsolomon1124
bsolomon1124 / qparser.py
Last active August 28, 2019 13:19
Boolean query string parser
"""Boolean query parser."""
import collections
import enum
import re
from typing import Generator, Iterable, List, Optional, Sequence, Tuple, Union
class BooleanOp(enum.Enum):
# Note: Enum defines __hash__ as hash(self._name_)
@bsolomon1124
bsolomon1124 / nmf_demo.py
Last active August 2, 2019 13:51
TFIDF -> NMF Topic-Term Extraction
import logging
from typing import List, Tuple
import numpy as np
from scipy import sparse
from sklearn.decomposition import NMF
from sklearn.feature_extraction.text import TfidfVectorizer
logging.basicConfig(
level=logging.DEBUG, format="%(created)f [%(levelname)s] %(message)s"
@bsolomon1124
bsolomon1124 / pydevosx
Last active May 8, 2019 16:58
Clone & make CPython for development on Mac OS X.
#!/bin/bash
#
# Clone & make CPython for development on Mac OS X.
#
# - Clones CPython into your current directory
# - Installs developer tools & development headers if needed, via brew
# - Configures, makes, tests Python
# - Launches Python REPL
#
# The output is verbose by default.
@bsolomon1124
bsolomon1124 / quickup.sh
Created March 7, 2019 00:02
Redis quick setup on Mac OSX + Linux
#!/usr/bin/env sh
#
# Miniature version of redis/utils/install_server.sh
# compatible across OS X + Linux
if [ "$(id -u)" -ne 0 ]; then
echo "Must run as root"
exit 1
fi
print(0xc0ffee)
This file has been truncated, but you can view the full file.
https://www.kitchenertoday.com/world-news/trumps-ag-nominee-defends-memo-criticizing-mueller-probe-1194852
http://www.bomboradyo.com/coa-resident-auditor-nasita-sa-kamara-dahil-sa-flood-control-scam/
https://www.derbytelegraph.co.uk/news/local-news/live-a6-flood-traffic-delays-2430621
http://showbizplus.com/index.php/blog/49735/home-insurance-five-ways-to-less/
https://autoblog.com.ar/2019/01/15/proyecto-cyclone-ya-es-oficial-las-ford-ranger-y-vw-amarok-compartiran-plataforma-a-partir-de-2022/
https://www.ft.com/content/7990545e-18c7-11e9-b93e-f4351a53f1c3?FTCamp=engage/CAPI/webapp/Channel_Moreover//B2B
http://blog.geogarage.com/2019/01/ocean-warming-is-accelerating-faster.html
https://liberal.com.br/cidades/nova-odessa/oab-de-nova-odessa-pede-intervencao-em-cobranca-da-taxa-de-lixo-943237/
https://theopenview.in/2019/01/15/pongal-celebrated-in-tn-with-traditional-fervour/
https://www.huffingtonpost.co.uk/entry/canada-issues-high-caution-travel-warning-for-china-amid-citizens-death-sentence_uk_5c3d9bd2e4b0922
import asyncio
async def foo():
await asyncio.sleep(1)
return 2
async def bar():
f1 = await foo()
f2 = await foo()
return f1, f2