Skip to content

Instantly share code, notes, and snippets.

@santiago-salas-v
santiago-salas-v / KinKat_01.ipynb
Last active March 29, 2019 09:19
Atkins Kinetik-Ü
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@santiago-salas-v
santiago-salas-v / cn_2.2.py
Created February 20, 2019 17:27
Chork-Niem 2.2 Kin-Kat
from scipy import integrate
from numpy import array, linspace
from matplotlib import pyplot as plt
%matplotlib inline
xi = -0.1+1/3
k1=0.1
k_ggw=2**2*xi**3/((1/3-xi)*(2/3-2*xi)**2)
k2=k1/k_ggw
print('xi={:f}'.format(xi))
print('K={:f}'.format(k_ggw))
@santiago-salas-v
santiago-salas-v / log_wake.c
Created December 21, 2018 17:00
schedule log wake (win scheduler - system - power-troubleshooter - event id 1)
#include <time.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/stat.h>
int file_exists(const char *filename){
struct stat buffer;
return (stat (filename, &buffer) == 0);
}
@santiago-salas-v
santiago-salas-v / faltung.m
Created December 10, 2018 23:28
sigma(t-1) * 2 exp(-t) sigma(t) zeichnen
t=linspace(-5,5,30);
plot(...
t,mean(diff(t))*conv(...
heaviside(t-1), 2*exp(-t).*heaviside(t),'same'),...
t,2*heaviside(t-1).*(1-exp(1-t).*heaviside(t-1)));
import matplotlib.pyplot as plt
import numpy as np
t=np.linspace(2,7,20)
plt.plot(t, -1-np.exp(-t/2)+2*np.exp(-(t-2)/2)-(1-1/np.exp(1)),
'o', t, (1/(2*np.exp(1))-1)*(t-2), '.', [min(t),max(t)],[-2+1/np.exp(1)]*2,'-')
@santiago-salas-v
santiago-salas-v / csv_from_data.py
Created October 22, 2018 12:33
csv with comma decimal separator and defined delimiter character
x=1
file=open('Daten.csv', mode='w')
file.write('sep= \n')
for line in open('Kalibrierung Spektren.Master.Absorbance'):
if x>19 and x<2068:
file.write(line.replace('.',','))
x+=1
file.close()
@santiago-salas-v
santiago-salas-v / change_file_date_to_name_date_2_opts.py
Last active September 16, 2018 21:23
Dates on the name of Whatsapp pictures are applied to the file
import re
import os
import datetime
import time
from shutil import copyfile
regex_filename = \
r'([0-9]{4})([0-9]{2})([0-9]{2})' + \
'[\_|\-]([0-9]{2})([0-9]{2})([0-9]{2})' + \
'.*(\.jpe?g|\.png)' + \
@santiago-salas-v
santiago-salas-v / ipy_io_history.py
Created September 16, 2018 18:15
ipython / jupyter console: Print input and output history
for i in range(0,88):
print('In['+str(i)+']: '+In[i])
if i in Out.keys():
print('Out['+str(i)+']: '+str(Out[i]))
@santiago-salas-v
santiago-salas-v / ode_two_methods.py
Created September 7, 2018 17:56
both ivp methods odeint & ode (oo version)
import numpy as np
from matplotlib import pyplot as plt
from scipy.integrate import odeint
from scipy.integrate import ode
def dydx(y, t0, epsilon):
dy0_dx = y[1]
dy1_dx = ((1-y[0]**2)*y[1]-y[0])/epsilon
return np.array([
dy0_dx,
{
"cmd": ["g++","-std=c++11","-Wall","*.cpp", "-I",
"../header","-o", "${file_path}/${file_base_name}",
"&&",
"${file_path}/${file_base_name}"],
"selector": "source.c++",
"shell": true
}