Skip to content

Instantly share code, notes, and snippets.

Avatar

Xavier Robin xrobin

View GitHub Profile
@xrobin
xrobin / robo3T_desktop_entry.md
Last active Mar 27, 2020 — forked from LogansUA/robomongo_desktop_entry.md
Example of desktop entry on Ubuntu system for Robo 3T
View robo3T_desktop_entry.md

Creating desktop entry

$ touch /usr/share/applications/robo3t.desktop

Edit

$ vim /usr/share/applications/robo3t.desktop
View ScopedTemporaryFile.py
import errno
import tempfile
import os
class ScopedTemporaryFile(object):
""" Temp file to use in a with statement.
with ScopedTemporaryFile() as f:
... do stuff with f ...
@xrobin
xrobin / TestOSTVerbosityLevels.py
Created May 24, 2018
Tests the verbosity levels of OST, with argparse magic. Pass -v, -vv, to increase verbosity, -q, -qq, -qqq to decrease.
View TestOSTVerbosityLevels.py
#!/usr/bin/env python2.7
import argparse
from ost import *
def testVerbosityLevel():
print("Verbosity: %d" % GetVerbosityLevel())
LogError("LogError") # >= 0
LogWarning("LogWarning") # >= 1
LogScript("LogScript") # >= 2
@xrobin
xrobin / fail2ban-allstatus.sh
Created Jan 19, 2017 — forked from kamermans/fail2ban-allstatus.sh
Show status of all fail2ban jails at once
View fail2ban-allstatus.sh
#!/bin/bash
JAILS=`fail2ban-client status | grep "Jail list" | sed -E 's/^[^:]+:[ \t]+//' | sed 's/,//g'`
for JAIL in $JAILS
do
fail2ban-client status $JAIL
done
View DeepLearningSegfault
install.packages(c("Rcpp", "plotrix", "RcppEigen", "BH", "devtools"))
library("devtools")
install_github(repo = "mnist", username = "xrobin", ref = "master")
install_github(repo = "DeepLearning", username = "xrobin", ref = "master")
my.diag.function <- function(rbm, batch, data, iter, batchsize, maxiters, layerFromCpp) {
print(iter)
}