Skip to content

Instantly share code, notes, and snippets.

View P8H's full-sized avatar
🛰️

Kevin P8H

🛰️
  • Darmstadt, Germany
  • 23:43 (UTC +01:00)
View GitHub Profile
@P8H
P8H / tildedb_dask_dataframe_example.py
Created August 8, 2022 07:23
Load a TileDB DataFrame with Dask Delayed - Example with a timeseries (Slicing on DateTimeIndex)
import dask
import numpy as np
import pandas as pd
import dask.dataframe as ddf
dask_chunks = 20
# Partition the dataframe
slices = [
np.datetime64(d)
@P8H
P8H / snippet.py
Last active April 4, 2022 06:12
Display two Images or SVGs side by side in a Jupyter/Colab Notebook
from IPython.display import HTML
style = "<style>#output-body{display:flex; flex-direction: row;}</style>"
display(HTML(style))
display(SVG('level_0_eval/cg.svg'))
display(SVG('level_0_eval/cg.svg'))
@P8H
P8H / install.sh
Last active January 10, 2017 21:55
#!/bin/bash
mkdir /etc/resilio
cd /etc/resilio
wget -N --no-check-certificate https://download-cdn.resilio.com/stable/linux-arm/resilio-sync_arm.tar.gz
tar xvzf resilio-sync_arm.tar.gz
rm resilio-sync_arm.tar.gz
wget -N --no-check-certificate https://gist.githubusercontent.com/P8H/379f5e48a66794311fefd86e74022d54/raw/resilio.conf
cd /etc/init.d/
wget -N --no-check-certificate https://gist.githubusercontent.com/P8H/379f5e48a66794311fefd86e74022d54/raw/resiliod
e
@P8H
P8H / TestClass.java
Last active October 27, 2016 13:07
Deeplearning4j with GPU/CUDA on SLURM
import org.nd4j.jita.conf.CudaEnvironment;
import org.nd4j.jita.conf.Configuration;
public class TestClass {
public static void main(String[] args) throws Exception {
CudaEnvironment.getInstance().getConfiguration().allowMultiGPU(true); //Use all available GPUs
DataTypeUtil.setDTypeForContext(DataBuffer.Type.HALF); //Use half precision, boost learning up to 200%
CudaEnvironment.getInstance().getConfiguration()
.setMaximumDeviceCacheableLength(1024 * 1024 * 1024L)
@P8H
P8H / AutoEncoderExample.java
Last active August 31, 2016 16:58
Autoencoder with evaluation
import org.deeplearning4j.datasets.fetchers.MnistDataFetcher;
import org.deeplearning4j.datasets.iterator.impl.MnistDataSetIterator;
import org.deeplearning4j.nn.api.OptimizationAlgorithm;
import org.deeplearning4j.nn.conf.MultiLayerConfiguration;
import org.deeplearning4j.nn.conf.NeuralNetConfiguration;
import org.deeplearning4j.nn.conf.layers.OutputLayer;
import org.deeplearning4j.nn.conf.layers.RBM;
import org.deeplearning4j.nn.multilayer.MultiLayerNetwork;
@P8H
P8H / mi-demo.arff
Created April 18, 2016 15:48
An ARFF file for MI learning with Weka
% synthetic dataset for multiple-instance learning using standard MI assumption.
@relation demo1
@attribute bag_XY {BAGN-1,BAGN-2,BAGP-3}
@attribute bag relational
@attribute f1 numeric
@attribute f2 numeric
@end bag
@P8H
P8H / install_watchdog.sh
Last active July 24, 2021 16:53
Watchdog install script for Raspberry Pi
# Watchdog install script for raspberry pi
# based on http://binerry.de/post/28263824530/raspberry-pi-watchdog-timer
# first think about to update the firmaware: rpi-update
sudo bash
apt-get install watchdog chkconfig
modprobe bcm2708_wdog
echo "WantedBy=multi-user.target" >> /lib/systemd/system/watchdog.service
# http://raspberrypi.stackexchange.com/a/33901
@P8H
P8H / ipc.py
Created December 8, 2015 08:28
Python BaseManager: stop serve_forever
from multiprocessing.managers import BaseManager
class IPC(BaseManager):
"""Little example how to provide a shutdown() function if you us the serve_forever method
"""""
_server_object = None # docs.python.org/3.5/library/multiprocessing.html#multiprocessing.managers.BaseManager
def __init__(self):
BaseManager.__init__(self, address=('127.0.0.1', 4000), authkey=b'42')