Skip to content

Instantly share code, notes, and snippets.

View dopplershift's full-sized avatar
😱
Hair on fire

Ryan May dopplershift

😱
Hair on fire
View GitHub Profile
@23ccozad
23ccozad / plot_geometry.ipynb
Last active July 1, 2023 13:52
MetPy PlotGeometry Class
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@deeplycloudy
deeplycloudy / get_dois.sh
Created June 1, 2021 22:26
DOI URLs scraped from webpages
# Here’s the URL to a journal’s search results page for papers from the Geostationary Lightning Mapper that
# were published from 2018-2021. There are several pages of results; below is an example of the third and final URL
# Download the webpage. Do this for each page of the search results, changing the URL and output filename:
curl "https://journals.ametsoc.org/search?access_0=all&fromDate=2018&page=3&pageSize=50&q1=geostationary+lightning+mapper&sort=relevance&toDate=2021" > page3dois.txt
# Then concatenate all three files, and save out just the DOIs linked on each page.
cat page[1-3]dois.txt | grep -Eoi '<a [^>]+>' |
@mcnees
mcnees / graph paper.tex
Last active February 16, 2024 08:34
Make your own quadrille, graph, hex, etc paper! Uses the pgf/TikZ package for LaTeX, which should be part of any modern TeX installation.
%%-----------------------------------------------------------------------
%% Make your own quadrille, graph, hex, etc paper!
%% Uses the pgf/TikZ package for LaTeX, which should be part of
%% any modern TeX installation.
%% Email: mcnees@gmail.com
%% Twitter: @mcnees
%%-----------------------------------------------------------------------
\documentclass[11pt]{article}
@teoliphant
teoliphant / rolling.py
Last active October 23, 2019 19:54
Create a function to make a "sliding_window" output array from an input array and a rolling_window size.
import numpy as np
def array_for_sliding_window(x, wshape):
"""Build a sliding-window representation of x.
The last dimension(s) of the output array contain the data of
the specific window. The number of dimensions in the output is
twice that of the input.
Parameters
@karpathy
karpathy / min-char-rnn.py
Last active May 6, 2024 16:42
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@splinterofchaos
splinterofchaos / Py.h
Last active August 29, 2015 14:10
Python API in C++
#ifndef PY_H
#define PY_H
#include <Python.h>
#include <type_traits>
#include <utility>
#include <string>
template<typename R, typename...X>
import json
from pprint import pprint as pp
import numpy as np
from numba import autojit, typeof, int32
INF = float('inf')
@autojit
def jenks_matrics_init(data, n_classes, ):
@vene
vene / magic_memit.py
Created June 30, 2012 06:55
memit: magic memory usage benching for IPython
# Author: Vlad Niculae <vlad@vene.ro>
# Makes use of memory_profiler from Fabian Pedregosa
# available at https://github.com/fabianp/memory_profiler
from IPython.core.magic import Magics, line_magic, magics_class
class MemMagics(Magics):
@line_magic
def memit(self, line='', setup='pass'):
@deeplycloudy
deeplycloudy / audioplayer.py
Created March 21, 2012 20:37
Simple Python audio player with matplotlib and pyaudio
""" Play an audio file with pyaudio while concurrently showing audio playhead
on a matplotlib plot of the audio time series and spectrogram.
Adjust duration and filename in the script below to reflect your audio file.
v. 0.1
21 Mar 2012
Eric Bruning
"""
@WeatherGod
WeatherGod / README
Created March 6, 2012 22:05
finding sensible defaults for ffmpeg (aiming for cross-compatibility)
So, provided you have some image files of form "_tmp0000.png", you can run generate_movies.sh to create a "result.txt" file which contains a list of the files successfully generated.
Additional columns are used to indicate testing status: '1' (failed), '0' (successful), '0.5' (works, but serious artifacts), '?' (couldn't try).
The script will provide the first column by testing if the movie plays using ffplay. Note, no movie gets displayed to the screen, so this is fairly quick. I have included my "result.txt" file which contains testing results for additional platforms. Platforms are:
* LibreOffice Impress on Linux
* QuickTime on Mac
* MS Office PowerPoint on Mac
* OpenOffice Impress on Mac