Skip to content

Instantly share code, notes, and snippets.

@KKostya
KKostya / Slider.js
Last active August 29, 2015 13:56
Lienard -- Wiechert
function slider(dom)
{
var margin = {top: 5, left: 15, right: 10, bottom: 5},
width = 300 - margin.left - margin.right,
height = 40 - margin.top - margin.bottom,
brush = d3.svg.brush(),
handle, slider,
value = 0,
upd = function(d){value = d;},
cback = function(d){};
@KKostya
KKostya / data
Last active August 29, 2015 13:58
{ "metadata": { "name": "Legge_per_parabola" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "La lungezza della curva $y(x)$ pu\u00f2 essere calcolata come\n", "\n", "$$ \\ell = \\int_{x_a}^{x_b}\\sqrt{1+\\left(\\frac{dy}{dx}\\right)^2}dx$$\n", "\n", "per la nostra parabola $y(x) = \\frac{x^2}{2b}$, $\\frac{dy}{dx} = \\frac{x}{b}$" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "L'intergale indefinito \u00e8 ([Vedi qui][1]):\n", "\n", "$$ \\int\\sqrt{1+\\frac{x^2}{b^2}}dx = \\frac{x}{2}\\sqrt{1+\\frac{x^2}{b^2}} + \\frac{b}{2} arcsinh\\frac{x}{b} + C$$\n", "\n", "\n", "[1]: http://www.wolframalpha.com/input/?i=intergrate+sqrt%281%2B%28x*x%29%2F%28b*b%29%29+dx" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Modulo della velocita $v$ \u00e8 sempre costante. \n", "Quindi $\\ell(t) = v\\cdot t$" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Sciegliamo condtizioni iniziali cosi: \n", "\n", "$$x(0) =
@KKostya
KKostya / index.html
Last active August 29, 2015 14:01
index.html
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.link {
fill: none;
stroke: #666;
stroke-width: 1.5px;
}
# Flush
iptables -F
# Accept ssh
iptables -A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
# Accept outgoing connections
iptables -I INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# Accept lo interface
iptables -A INPUT -i lo -j ACCEPT
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.node circle { fill: #fff; stroke: steelblue; stroke-width: 1.5px; }
.link { fill: none; stroke: #ccc; stroke-width: 1.5px; }
</style>
<body>
<input id="toparse" type='text' style="width:500px" value="42 * (111+10) / (7+4)"/>
<script src="http://d3js.org/d3.v3.min.js"></script>
@KKostya
KKostya / index.html
Last active August 29, 2015 14:12
Token stream visual
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.link { stroke: #999; }
</style>
<body>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script>
function formatNode()
@KKostya
KKostya / setup.sh
Last active August 29, 2015 14:15
OpenStack VM setup
# Instance Boot Source : SLC6 Server
# don't forget to create and select a key pair
################## First we'll create a partition on the ephemeral storage
ssh root@name-of-instance
fdisk /dev/vda
u # switch to other untis
n # new partition
p # primary
@KKostya
KKostya / CERN_OpenStack.py
Last active August 29, 2015 14:15
Fabric everywhere
import StringIO
from fabric.api import *
env.hosts = [""]
krbconf = StringIO.StringIO("""
[libdefaults]
default_realm = CERN.CH
ticket_lifetime = 24h
renew_lifetime = 7d
@KKostya
KKostya / install.sh
Created May 10, 2015 20:48
rabbitmq script
wget http://www.erlang.org/download/otp_src_17.5.tar.gz
wget https://www.rabbitmq.com/releases/rabbitmq-server/v3.5.1/rabbitmq-server-generic-unix-3.5.1.tar.gz
tar xvvf otp_src_17.5.tar.gz
cd otp_src_17.5
./configure --prefix=$PWD/../erlang
make && make install
cd -
@KKostya
KKostya / index.html
Created September 28, 2015 19:22
Running chain
<style>
.line { fill: none; stroke: black; stroke-width: 0.5px; }
.force { fill: none; stroke: red; stroke-width: 0.5px; }
.circle { fill: none; stroke: black; stroke-width: 0.5px; }
</style>
<body>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script>
var N = 50, v0 = 1, k = 100, h = 0.01;
var beads = d3.range(N).map(function(i){