Skip to content

Instantly share code, notes, and snippets.

brew uninstall xmlsec1
cd "$(brew --prefix)/Library/Taps/homebrew/homebrew-core/Formula"\
git checkout 1d8e658f5ad489fe71f8d194c97811143aa46ec5
git reset --hard  1d8e658f5ad
git checkout -b libxmlsec1-downgrade-1.2.34
brew install libxmlsec1
brew pin libxmlsec1
git checkout master
brew update
@mariokostelac
mariokostelac / debug_trax_layer.py
Created February 4, 2021 09:04
Debug layer for trax, prints out the shape of the data it works with
from trax.layers import base
class Debug(base.Layer):
def __init__(self, msg=""):
super().__init__(name=f'Debug')
self.msg = msg
self.debug = False
def forward(self, x):
if self.debug:
@mariokostelac
mariokostelac / tensorboard_with_ngrok.sh
Created June 9, 2020 11:28
Reverse proxy tensorboard on SageMaker
wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip
unzip ngrok-stable-linux-amd64.zip
./ngrok http 17605 --log=stdout > /var/log/ngrok.log &
NGROK_URL=$(grep -Eo 'url=.+' /var/log/ngrok.log | cut -d= -f2 | tail -n 1)
echo "NGROK URL: ${NGROK_URL}"
# start tensorboard
tensorboard --logdir . --port 17605
from constraint import *
def count_same_digits(n1, n2):
return len(set(n1).intersection(n2))
def count_same_position(n1, n2):
return (n1[0] == n2[0]) + (n1[1] == n2[1]) + (n1[2] == n2[2])
def check(n1, n2, correct_nums, correct_placed):
return count_same_digits(n1, n2) == correct_nums and count_same_position(n1, n2) == correct_placed
i = 0
def dfs(arr, x, y):
if x < 0 or x >= len(arr) or y < 0 or y >= len(arr[0]):
return
if arr[x][y] == 'x':
return
arr[x][y] = 'x'
global i; i+=1
@mariokostelac
mariokostelac / goodnight-sagemaker.py
Last active August 17, 2019 21:00
Turn off SageMaker instance when inactive!
import psutil
import GPUtil
import os
import sys
import logging
from daemonize import Daemonize
from time import sleep
from pprint import pprint as pp
def netcons(listen_port=None,status=None,pid=None):
def process(arg1)
raise SomeDeepPackagr::InvalidInputError.new(“#{arg1} is not negative”) if arg >= 0
end
describe “.process” do
it “raises if arg1 is not negative” do
expect { process(0) }.to raise_error(StandardError)
end
end
def process(arg1)
raise SomeDeepPackage::InvalidInputError.new(“#{arg1} is not negative”) if arg >= 0
end
[{"delete":{"direct_message":{"id":755045701202145288,"id_str":"755045701202145288","user_id":2573102694}}}]