Skip to content

Instantly share code, notes, and snippets.


Allan L. R. Hansen AllanLRH

  • Copenhagen, Denmark
View GitHub Profile
AllanLRH /
Created Apr 7, 2017 — forked from nimezhu/
plot directed graph (python matplotlib)
# programmer : zhuxp
# usage:
import sys
from getopt import getopt
import networkx as nx
import matplotlib.pyplot as plt
def show_help():
print >>sys.stderr,"\n\ drawing causal graph from LiNGAM output equation matrix B"
print >>sys.stderr,"Library Dependence: networkx , matplotlib\n\n"
AllanLRH / get_sql_schema_information.sql
Created Apr 1, 2020
Get SQL scheme information for table
View get_sql_schema_information.sql
AllanLRH /
Last active Jan 8, 2020
Scientific Python Imports
import pandas as pd
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import seaborn as sns
AllanLRH /
Created Jan 6, 2020
#resample #train_test_split
import imblearn
from sklearn import model_selection
rus = imblearn.under_sampling.RandomUnderSampler(sampling_strategy=1.0, random_state=42)
X, y = rus.fit_sample(df.drop('Target', axis=1), df.Target)
X_train, X_test, y_train, y_test = model_selection.train_test_split(X, y, test_size=0.33, random_state=42)
AllanLRH /
Created Nov 27, 2019 #python #loguru #logging
from loguru import logger
STARTED_TIME_STR ="%m_%d_%Y__%H_%M_%S")
logger.add(f"{LOGGING_PATH}/model_{STARTED_TIME_STR}.log", level='DEBUG') # Save DEBUG level to a file
logger.add(sys.stdout, level='INFO') # Print INFO level to stdout
View image_convolution_mean_example.m
% ****************************************************************************
% * This demonstrate how to apply blur to an RGB-image, and create a third *
% * image which is composed partly of the original unblurred image, and *
% * partly of the blurred image. *
% ****************************************************************************
% Read example image built into MATLAB
I0 = double(imread('saturn.png'));
AllanLRH /
Last active Oct 31, 2018
Disable Spotify autoupdate on Mac OS X (testet on Yosemite).
# This script prevents Spotifys Autoupdating on OS X (testet on Yosemite)
# Based on this tutorial:
# This script must be run as root:
# sudo sh
if [ "$(id -u)" != "0" ]; then
AllanLRH /
Last active Sep 21, 2017
Christian Sublime Text tips

Hej Christian

Lige et par tips om Sublime Text, siden du er begyndt at bruge den mere :)

Sublime Text (ST) har en pakkemanager. Den hedder Package Control, og kan i nyeste udgave af ST installeres fra Command Palette (ctrl+shift+p) ved at vælge "Install package control". Du kan finde pakker og beskriveser på

Jeg vil plejer at dele pakker op i domænespecifikke pakker, fx en linter til Python, og generelle pakker, fx noget som gør navigation i teksten nemmere. Her er de pakker som jeg er gladest for...

View .hyper.js
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See for all currently supported options.
module.exports = {
config: {
// default font size in pixels for all tabs
fontSize: 12,
// font family with optional fallbacks
AllanLRH / Vitual keystroke example
Created May 17, 2017 — forked from chriskiehl/Vitual keystroke example
Python win32api simple Vitual keystroke example
View Vitual keystroke example
#Giant dictonary to hold key name and VK value
VK_CODE = {'backspace':0x08,
You can’t perform that action at this time.