Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@pozitron57
pozitron57 / Rurikovichi
Last active September 14, 2015 19:31 — forked from robschmuecker/README.md
Rurikovichi family tree
Family tree for the Rurikovichi from Rurik to Ivan the Terrible, 9–16 centuries.
json_generator.py is a python script which generates py_generated.json file from the source.data file.
Source.data file contains list of Rurik's descendants.
This file is easy to fill: each person in the same generation has the same amount of leading spaces.
#coding=utf8
import numpy as np
from matplotlib import *
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
from matplotlib.ticker import AutoMinorLocator
from math import exp
from distinct_colors import get_distinct
''' Decay of 56Ni '''
@pozitron57
pozitron57 / decay.py
Created October 17, 2016 18:46
2-step decay chain Ni→Co→Fe
#coding=utf8
import numpy as np
from matplotlib import *
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
from matplotlib.ticker import AutoMinorLocator
from math import exp
from distinct_colors import get_distinct
''' Decay of 56Ni '''
@pozitron57
pozitron57 / gridspec.py
Created October 17, 2016 20:09
gridspec in python matplotlib
#! /usr/bin/env python
#coding=utf8
from pylab import *
from matplotlib import *
gs = gridspec.GridSpec(2, 1) #subplots ratio
f, (ax1, ax2) = plt.subplots(2, sharex=True)
ax1 = plt.subplot(gs[0, 0])
ax2 = plt.subplot(gs[1, 0])
@pozitron57
pozitron57 / find-unused-latex-plots.py
Last active June 29, 2018 12:28
Python3 script to find and move unused plots in latex project
#! /usr/bin/env python
#coding=utf8
import re, os
path = '/home/slisakov/Dropbox/documents/science/thesis/'
plots = '/home/slisakov/Dropbox/documents/science/thesis/plots/'
used_plots = [] # present in tex
commented_plots = [] # present in tex, commented
@pozitron57
pozitron57 / neglect.py
Created September 16, 2018 14:06
Literacy vs. physics level
#! /usr/bin/env python
#coding=utf8
import numpy as np
from matplotlib import rc, rcParams
import matplotlib.pyplot as plt
from matplotlib.ticker import AutoMinorLocator, MultipleLocator
# Plot Setup {{{
rcParams['font.size'] = 16.
@pozitron57
pozitron57 / kepler2alpha-1.py
Last active January 2, 2022 19:31
Plot for body launched at alpha to horizon with circular velocity
import os
import numpy as np
from matplotlib.patches import Ellipse
import matplotlib as mpl
from matplotlib import pyplot as plt
from matplotlib import rc, rcParams
from matplotlib.ticker import AutoMinorLocator, MultipleLocator
from matplotlib.patches import Arc
# Trigonometry {{{
import numpy as np
def cos(x):
return round( np.cos( np.radians(x) ), 10 )
def sin(x):
return round( np.sin( np.radians(x) ), 10 )
def asin(x):
return np.degrees( np.arcsin(x) )
# Plot setup {{{
@pozitron57
pozitron57 / ftr-a-mu.py
Created February 7, 2022 20:04
Plot friction force vs. angle
import numpy as np
# Triginometry {{{
def cos(x): return round( np.cos( np.radians(x) ), 10 )
def sin(x): return round( np.sin( np.radians(x) ), 10 )
def tg(x): return round( np.tan( np.radians(x) ), 10 )
def arctg(x): return np.degrees( np.arctan(x) )
def sins(x): return round( np.sin( np.radians(x) )**2, 10 )
def asin(x): return np.degrees( np.arcsin(x) )
#}}}
@pozitron57
pozitron57 / button.html
Created February 12, 2023 22:21
Change button text onclick and show/hide element.
<script>
function toggleHidden() {
document.getElementById("solution").classList.toggle('hidden');
if ( document.getElementById("solution").classList.contains('hidden') ) {
document.querySelector('#btn').innerText = 'Показать решение';
} else {
document.querySelector('#btn').innerText = 'Скрыть решение';
}
}
</script>