Skip to content

Instantly share code, notes, and snippets.

diff --git a/baby_first.cpp b/baby_second.cpp
index 08796aa..746f847 100644
--- a/baby_first.cpp
+++ b/baby_second.cpp
@@ -24,37 +24,24 @@ void cartProduct(std::set<int> const &n, std::set<float> const &b1, Iterator out
}
template<typename T>
-void strToType(std::string const &str, T *value, int range) {
+T strToType(std::string const &str, int range) {
@Keating950
Keating950 / generator_eg.rs
Last active August 7, 2021 15:04
Example of a Rust generator and a corresponding Iterator.
#![feature(generators, generator_trait)]
use std::{
iter,
ops::{Generator, GeneratorState},
pin::Pin,
};
pub struct Grid<const R: usize, const C: usize> {
grid: [[bool; C]; R],
@Keating950
Keating950 / install_scipy.sh
Last active August 4, 2021 20:14
Build Scipy on M1
#!/bin/sh
pip install cython pybind11 pythran
OPENBLAS=$(brew --prefix openblas) CFLAGS="-falign-functions=8 ${CFLAGS}" pip install --no-use-pep517 scipy
@Keating950
Keating950 / brew-isearch
Created January 26, 2021 15:06
Search Homebrew formulae with FZF. Just put the script somewhere in your $PATH and call via "brew isearch".
#!/usr/bin/env zsh
traverse()
{
find "$1" -regex ".*\.rb" | while read line; do
echo $line:t:r
done
}
traverse "$(brew --prefix)/Library/Taps" | fzf --preview 'brew info {}'
@Keating950
Keating950 / blocklist.txt
Created December 25, 2020 17:28
LG smart TV DNS block list
# LG
us.rdx2.lgtvsdp.com
us.info.lgsmartad.com
us.ibs.lgappstv.com
us.lgtvsdp.com
ad.lgappstv.com
smartshare.lgtvsdp.com
ibis.lgappstv.com
us.ad.lgsmartad.com
lgad.cjpowercast.com.edgesuite.net
def extract():
"""Copies the caller's environment up to your IPython session"""
import inspect
import ctypes
frames = inspect.stack()
caller = frames[1].frame
name, ls, gs = caller.f_code.co_name, caller.f_locals, caller.f_globals
ipython = [f for f in inspect.stack() if f.filename.startswith('<ipython-input')][-1].frame