Skip to content

Instantly share code, notes, and snippets.

View ramcandrews's full-sized avatar
Working from home

Ryan McAndrews ramcandrews

Working from home
View GitHub Profile
ramcandrews / base reset css
Created April 22, 2023 00:42
Use this to reset the css styles so thigns are easier to debug.
*, *::before, *::after {
box-sizing: border-box;
* {
margin: 0;
padding: 0;
font: inherit;
ramcandrews / select empty elements
Last active April 22, 2023 00:33
hide anything that does not have inner text
div:empty {
outline: 2px solid deeppink;
height: 1em;
:empty:not(img, picture, button, input) {
display: none;
/* */
ramcandrews / easy responsive width
Last active April 22, 2023 00:27
responsive container with gutter and a max width, center horizontally,
.container {
width: min(100% - 2rem, 600px);
margin-inline: auto;
/* */
ramcandrews /
Last active July 26, 2022 04:39
a python regex to grab every japanese word from an HTML file
import re
with open(rootdir + "something in japanese.html", encoding='utf-8', errors='ignore') as reader:
for line in reader:
words = re.findall(r"[一-龯ぁ-んァ-ン!:/・()ー]*", line)
for word in words:
if word:
[^@ \t\r\n]+@[^@ \t\r\n]+\.[^@ \t\r\n]+
[^@ \\t\\r\\n] matches for anything other than @, space, tab, new lines repetitions of a non-whitespace character. (04/17/2022)
ramcandrews / email regex
Last active March 17, 2022 06:55
General Email Regex (RFC 5322 Official Standard)
Regex for matching ALL Japanese common & uncommon Kanji (4e00 – 9fcf) ~ The Big Kahuna!
Regex for matching Hirgana or Katakana
Regex for matching Non-Hirgana or Non-Katakana
Regex for matching Hirgana or Katakana or basic punctuation (、。’)
first create a spatial lite db file. the sqlite file will be more than twice as large as the GDB directory.
ogr2ogr -f SQlite db.sqlite -f OpenFileGDB -overwrite tlgdb_2019_a_us_areawater.gdb
# this is mor than 100 years of global weather data 110GB
ramcandrews / pytorch chunk for
Last active February 26, 2020 08:55
Batch data into chunks using the pytorch TensorDataset and Dataloader classes
from import TensorDataset, DataLoader
import torch
# Check for a GPU
train_on_gpu = torch.cuda.is_available()
if not train_on_gpu:
print('No GPU found. Please use a GPU to train your neural network.')
def batch_data(words, sequence_length, batch_size):