Skip to content

Instantly share code, notes, and snippets.

# === Use a specific python version (with pyenv) ===
# Usage in .envrc:
# use python <version>
use_python() {
if has pyenv; then
local pyversion=$1
eval "$(pyenv init --path)"
eval "$(pyenv init -)"
pyenv local ${pyversion} || log_error "Could not find pyenv version '${pyversion}'. Consider running 'pyenv install ${pyversion}'"
fi
import {Injectable} from '@angular/core';
import {LoggerService} from './logger.service';
import {environment} from '../../../environments/environment';
import {LoggerProperties} from './logger-config';
@Injectable({
providedIn: 'root'
})
export class ConsoleLoggerService implements LoggerService {
enableInfo: boolean;
from typing import List
all_tiles = dict()
vector_map = {
'ne': (1, 1),
'nw': (-1, 1),
'e': (2, 0),
'w': (-2, 0),
'sw': (-1, -1),
'se': (1, -1)
@napisani
napisani / day24pt1.py
Created January 5, 2021 04:51
AoC2020-Day24pt1
from typing import List
all_tiles = dict()
vector_map = {
'ne': (1, 1),
'nw': (-1, 1),
'e': (2, 0),
'w': (-2, 0),
'sw': (-1, -1),
@napisani
napisani / day23pt2.py
Created January 3, 2021 23:20
AoC2020Day23pt2
from typing import List
class Link:
def __init__(self, cup_num, next_link=None):
self.cup_num: int = cup_num
self.next_link: Link = next_link
self.terminator = False
def __repr__(self):
@napisani
napisani / day22.py
Created January 2, 2021 04:14
AoC2020-day22pt2
from typing import List
def parse_decks(f):
player1_deck = []
player2_deck = []
current_deck = player1_deck
for line in f.readlines():
if line == '' or line == "\n" or line.lower().startswith('player 1'):
continue
@napisani
napisani / day20.py
Last active December 31, 2020 23:18
AoC Day 20
from copy import deepcopy
import math
from typing import List, Set
def join(itr):
return "".join(itr)
@napisani
napisani / fixCaskApps.sh
Created February 22, 2017 03:17
fix spotlight index of cask apps by creating alias files
#!/bin/bash
mdfind "kMDItemKind == 'Alias'" -onlyin /Applications/ | while read x ; do rm -f "$x" ; done
find /usr/local/Caskroom -name "*.app" | grep -E "/latest/[^/]*.app$" | while read x ; do
echo "$x"
SHORT=`echo $x | sed s/.app//g | sed 's/.*\/latest\///g' | sed 's/ /_/g' | awk '{print tolower($0)}' `
echo "$SHORT"
osascript<<EOF
set $SHORT to POSIX file "$x"
set applications_folder to POSIX file "/Applications"