Skip to content

Instantly share code, notes, and snippets.

@jonnyli1125
jonnyli1125 / weighted_sparse_categorical_crossentropy.py
Last active March 6, 2022 08:17
SparseCategoricalCrossentropy with class weights for Keras/Tensorflow 2
"""
Since Model.fit doesn't support class_weight when using multiple outputs,
this custom loss subclass may be useful.
Relevant issues:
https://github.com/keras-team/keras/issues/11735
https://github.com/tensorflow/tensorflow/issues/40457
https://github.com/tensorflow/tensorflow/issues/41448
"""
@KoryNunn
KoryNunn / handshake-airdrop.md
Last active March 12, 2024 07:03
Handshake airdrop for github users.

Had 15 github followers in 2019? You can get about $4kAUD of crypto for minimal effort.

Explain this scam

That's legitimately a good default position to hold, however, in this case, the free money is a function of time, and not only charity.

In February 2020, in order to promote Handshake (HNS) to developers, an airdrop was offered to any Github user with more than 15 followers. The Airdrop would give you 4246HNS, at the time worth around at $0.08USD per coin, for a total of $339.68USD, pretty generous!

Today, 4246HNS is worth around $4000 dollarydoos, and there are plenty of github users who haven't claimed theirs.

@ypwhs
ypwhs / transfer_learning.ipynb
Created October 5, 2017 08:15
Keras Inception + Xception (0.47)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@chrish10e
chrish10e / build.sh
Last active February 4, 2019 12:26 — forked from d2rk/build.sh
dlib for AWS lambda
$ sudo yum install -y python34 blas-devel lapack-devel gcc-c++ cmake python34-devel git
$ alias python=python3
$ wget --no-check-certificate -P /tmp https://dl.bintray.com/boostorg/release/1.64.0/source/boost_1_64_0.tar.bz2
$ tar xvf /tmp/boost_1_64_0.tar.bz2 -C /tmp
$ cd /tmp
$ cd boost_1_64_0
$ ./bootstrap.sh --with-libraries=python -with-python=/usr/bin/python3.4m --with-python-root=/usr/bin/python3.4m
@deehzee
deehzee / autoreload.md
Last active December 1, 2021 19:48
Auto reload of modules in jupyter notebook

Module autoreload

To auto-reload modules in jupyter notebook (so that changes in files *.py doesn't require manual reloading):

# for auto-reloading external modules
# see http://stackoverflow.com/questions/1907993/autoreload-of-modules-in-ipython
%load_ext autoreload
%autoreload 2
@zaiste
zaiste / rst_to_md.sh
Created February 5, 2017 18:54
Convert RST to Markdown using Pandoc
FILES=*.rst
for f in $FILES
do
filename="${f%.*}"
echo "Converting $f to $filename.md"
`pandoc $f -f rst -t markdown -o $filename.md`
done
@d2rk
d2rk / build.sh
Created December 4, 2016 11:37
dlib for AWS lambda
$ wget --no-check-certificate -P /tmp http://flydata-rpm.s3-website-us-east-1.amazonaws.com/patchelf-0.8.tar.gz
$ tar xvf /tmp/patchelf-0.8.tar.gz -C /tmp
$ cd /tmp/patchelf-0.8 && ./configure && make && sudo make install
$ sudo yum install -y blas-devel boost-devel lapack-devel gcc-c++ cmake python-devel git
$ git clone https://github.com/davisking/dlib.git
$ cd dlib/python_examples/
$ mkdir build && cd build
$ cmake -D USE_SSE4_INSTRUCTIONS:BOOL=ON ../../tools/python
$ cmake --build . --config Release --target install
@hvanhonacker
hvanhonacker / migrate_postgres_9.3_9.4_ubuntu_14.10.md
Last active May 13, 2023 06:22
Migration from postgresql 9.3 to 9.4

Upgrade from PostgreSQL 9.3 to 9.4 on Ubuntu 14.10

Install postgresql-9.4

$ sudo apt-get install postgresql-9.4

Then psql version should be 9.4.x

$ psql --version
@AnnaGerber
AnnaGerber / 11_piezo.py
Last active October 16, 2022 13:51
PyFirmata code for Freetronics Experimenter's Kit
import pyfirmata
import math
board = pyfirmata.Arduino("/dev/ttyACM0")
# connect piezo to pin 9 to use PWM
SENSOR_PIN = 0
PIEZO_PIN = board.get_pin('d:9:p')
it = pyfirmata.util.Iterator(board)