Skip to content

Instantly share code, notes, and snippets.

View Drvanon's full-sized avatar
😀
Ready to get working

Robin Alexander Dorstijn Drvanon

😀
Ready to get working
  • Groningen
View GitHub Profile
#!/bin/bash
stty -ixon # Disable ctrl-s and ctrl-q.
shopt -s autocd #Allows you to cd into directory merely by typing the directory name.
HISTSIZE= HISTFILESIZE= # Infinite history.
export PS1="\[$(tput bold)\]\[$(tput setaf 1)\][\[$(tput setaf 3)\]\u\[$(tput setaf 2)\]@\[$(tput setaf 4)\]\h \[$(tput setaf 5)\]\W\[$(tput setaf 1)\]]\[$(tput setaf 7)\]\\$ \[$(tput sgr0)\]"
[ -f "$HOME/.shortcuts" ] && source "$HOME/.shortcuts" # Load shortcut aliases
# System Maintainence
alias mw="~/.config/mutt/mutt-wizard.sh"
@Drvanon
Drvanon / sqlalchemy_template.py
Created May 6, 2013 12:45
Sqlalchemy template, because I hate repeating myself
from sqlalchemy import create_engine, Column, Integer, String # , ForeignKey
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker # , relationship, backref
engine = create_engine('sqlite://:memory:')
Base = declarative_base()
# Table classes here
# example:
class ClassBuilder:
def __init__(self):
self.data = {}
def load_source1(self, params_for_source1):
self.data.update(api_call_source1(params_for_source1))
def load_source1(self, params_for_source2):
self.data.update(api_call_source1(params_for_source2))
@Drvanon
Drvanon / vanon1.py
Created September 1, 2021 18:17 — forked from erezsh/vanon1.py
LALR try for vanon (1)
from lark import Lark
grammar = r"""
start: _NL* _section+
_section: _HEADER _content* _HEADER
_HEADER: "--- SECTION ---" _NL
_content: number_list
| assign
| _other
number_list: NUMBER+ _NL
/export/home/ccprakt3/miniconda3/lib/python3.9/site-packages/pandas/core/frame.py:3607: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
self._set_item(key, value)
# Data source
gen = ({'a': 3, 'b': 4} for i in range(300))
a = map(lambda d: d['a'], gen)
b = map(lambda d: d['b'], gen)
def outside_try():
foo = None
try:
foo = load_foo()
except FooLoadingError:
return "Foo failed to load"
# Do all the things
return foo
import numpy as np
from scipy.optimize import curve_fit
from scipy import signal
def gauss(x, mu, sigma, A):
return A / (sigma * np.sqrt(2 * np.pi)) * np.exp(- .5 * np.power((x-mu)/sigma , 2))
peakind = signal.find_peaks_cwt(inten_na2, np.arange(2,5), noise_perc=90, min_length=2, min_snr=2)
# plt.plot(lamb_na2, inten_na2)
a = ( (1, 2), (3, 6), (4, 8) )
b = ( 1, 3, 4)
c = a / b
c == ( (1, 2), (1, 2), (1, 2) )

This is a file that describes how our pipeline should be working for Marick Manrho. I hope it will be useful to him.