This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # first 10 naturals | |
| nat = np.arange(1,10) | |
| # multiply them | |
| nat_df = pd.DataFrame( | |
| columns=nat, | |
| index=nat, | |
| data=np.matmul(nat[:,np.newaxis],nat[:,np.newaxis].T)) | |
| def sumDigits(no): | |
| return 0 if no == 0 else int(no % 10) + sumDigits(int(no / 10)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ##### | |
| # colors: relabelling the classes using the first centroids values | |
| # calculate all the class centers in data space | |
| y = X.groupby(labels).mean().values | |
| # position of the data feature used to sort lables | |
| feature_index = find_nearest(700) | |
| # here the sorting index | |
| centroids_sorting_index = np.argsort(y[:, feature_index]) | |
| # here the sorting labels, not the index!! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # open a new vim file with syntaxt highlight set at cli. | |
| # example : vimscratch python | |
| # default : open a new file directly skipping github.com/mhinz/vim-startify | |
| alias vimscratch='_f() { if [ -z "$1" ]; then vim -c "let g:startify_disable_at_vimenter = 1"; else vim -c "let g:startify_disable_at_vimenter = 1" -c "set ft:$1" -c "set ft";fi }; _f' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [core] | |
| excludesfile = $HOME/.gitignore_global | |
| editor = vim | |
| # pager = delta | |
| [filter "media"] | |
| required = true | |
| clean = git media clean %f | |
| smudge = git media smudge %f | |
| [push] | |
| default = simple |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # define CONDACOMMAND externally to overwrite this, I use conda or mamba | |
| # default is to use mamba, a looooot faster | |
| CONDACOMMAND=${1:-'mamba'} | |
| # DRYRUNCONDACOMMAND : is set to anything, just print the commands | |
| if [ -z $DRYRUNCONDACOMMAND ] | |
| then | |
| echo "DRYRUNCONDACOMMAND is unset, this is the real stuff" | |
| DRYRUNCONDACOMMAND='' | |
| else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| alias open='xdg-open' # opening files with xdg-open on linux, on mac you don't need this. | |
| # open 1 file and send the proces in background | |
| function openback() { | |
| if [ "$#" -lt 1 ] | |
| then echo "openback : No input given" | |
| else open $1 > /dev/null & disown | |
| fi | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| """This module contains code related to NAIF/SPICE. | |
| """ | |
| import pathlib | |
| def update_metakernel(metakernel_path=pathlib.Path, | |
| metakernel_version=None, | |
| KPATH=None, | |
| outdir=None, | |
| symlink=None, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| link_to_tmp() { | |
| # define colors | |
| local RED = '\033[31m' # mode 31 = red forground | |
| local GREEN = '\033[32m' # mode 32 = green forground | |
| local RESET = '\033[0m' # mode 0 = reset | |
| # no input given | |
| if [ $# -eq 0 ] | |
| then | |
| local INPUT=$PWD |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # see : rpm - yum install in user home for non-admins | |
| # http://unix.stackexchange.com/questions/61283/yum-install-in-user-home-for-non-admins | |
| # Usage: | |
| # 0. check your architecture | |
| # uname -a | |
| # Linux laser.pe.ba.dlr.de 3.10.0-514.21.1.el7.x86_64 #1 SMP Sat Apr 22 02:41:35 EDT 2017 x86_64 x86_64 x86_64 GNU/Linux | |
| # | |
| # 1. search a packet for your architecture. | |
| # Example: gnu parallel for x86_64 architecture. |