Skip to content

Instantly share code, notes, and snippets.

@santiago-salas-v
santiago-salas-v / exportmhtum.py
Last active May 23, 2017 01:42
Modulhandbuecher mit selenium, urllib2, pandas, xlwings exportieren.
# coding=utf-8
import webbrowser
import urllib
import urllib2
from bs4 import BeautifulSoup
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium import webdriver
@santiago-salas-v
santiago-salas-v / Hagen_5.ipynb
Last active March 17, 2022 10:27
uses also \require{cancel}
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 / gk_analysis.ipynb
Last active August 1, 2017 01:59
leastsq, statsmodels
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 / draw-node.py
Last active August 28, 2017 11:29
annotation node
import matplotlib
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111)
patch1 = matplotlib.patches.Circle(
[0.5,0.5],0.05
)
patch2 = matplotlib.patches.Rectangle(
[0.3,0.3],0.4, 0.4, alpha=0.5,
fill=False, edgecolor='black',
@santiago-salas-v
santiago-salas-v / serve_simple_math_editor.py
Last active December 1, 2017 19:39
simple web server for VisualMathEditor: visualmatheditor.equatheque.net/
from http import server
import socketserver
import webbrowser
import threading
class ThreadingServer(socketserver.ThreadingMixIn, server.HTTPServer):
pass
PORT = 8000
@santiago-salas-v
santiago-salas-v / change_file_date_to_name_date.py
Last active January 4, 2018 19:53
Script to generate copies of files named 'fb_YYYY-MM-DD-hh-mm-ss_fbidxxxxxxxxx.jpg' . Copy them all to ./output and change modified date to the date referred to in the name. 2nd script with format "Whatsapp Image YYYY-MM-DD at hh-mm-ss"
import re
import os
import datetime
import time
from shutil import copyfile
regex_filename = \
'fb_([0-9]{4})-([0-9]{2})-([0-9]{2})' + \
'T([0-9]{2})-([0-9]{2})-([0-9]{2})_([0-9]+).jpg'
@santiago-salas-v
santiago-salas-v / black_body.py
Created October 22, 2017 18:26
Spektrales Emissionsvermögen des schwarzen Körpers. Abb. 1.4-7 Wedler, Physikalische Chemie
import matplotlib.pyplot as plt
import numpy as np
# rho = 8 pi hc/(lambda^5 *(exp(hc/(lambda k T)))-1)
# x = lambda k T /(h c)
# T = x *(h c)/(lambda k)
# rho = 8 pi hc/((h c)^5/(k T)^5 * x^5 *(exp(x)-1)
# rho = (8 pi (k T)^5/(h c)^4)/ (x^5 *(exp(x)-1))
title_text = 'Black Body Radiation'
n_temps = 10
pi = np.pi
@santiago-salas-v
santiago-salas-v / r_repl_str.py
Created January 4, 2018 22:24
recursively walk and replace file names containing str '[replaceme]'
import os
replace_str = '[replaceme]'
for root, dirs, files in os.walk('.'):
for file in files:
if replace_str in file:
new_file = file.replace(replace_str,'')
os.rename(
os.path.join(root,file),
os.path.join(root,new_file)
)
@santiago-salas-v
santiago-salas-v / win_mp3_file_metadata.py
Created May 14, 2018 11:13
get metadata of mp3 files
import os
import win32com.client
folder = os.path.abspath(u'.')
folder_exists = os.path.exists(folder)
sh=win32com.client.gencache.EnsureDispatch('Shell.Application',0)
ns=sh.NameSpace(folder)
colnum = 0
@santiago-salas-v
santiago-salas-v / put_tracknumber_at_start_of_title.py
Created May 14, 2018 15:01
ID3 tags tracknumber at start of title (for sorting by players)
import os
from mutagen.easyid3 import EasyID3
folder = os.path.abspath(u'.')
folder_exists = os.path.exists(folder)
for file in os.scandir(folder):
file_path = os.path.join(folder, file.name)
print(file_path)
actual_number = file.name.split('_')[0]