Skip to content

Instantly share code, notes, and snippets.

View jlavenderrose's full-sized avatar

Julia Lavender jlavenderrose

  • Boston
View GitHub Profile
@jlavenderrose
jlavenderrose / fp-in-java.md
Created December 1, 2016 01:07
Functional Programming in Java

Here's a brain dead fictious example

public void delete(final Collection<I> objects)
{
    for (I object : objects)
    {
        delete(object);
    }
}
/******************************************************************************
*
* Default Linker script for the Texas Instruments LM3S8962
*
* This is part of revision 11167 of the Stellaris Peripheral Driver Library.
*
*****************************************************************************/
MEMORY
{
@jlavenderrose
jlavenderrose / passgen.rb
Last active December 20, 2015 17:48
Quick and dirty random password generator for work.
#!/usr/bin/ruby
require 'securerandom'
require 'csv'
require 'optparse'
def generate_password()
while true do
pass = SecureRandom.base64(8).gsub(/[\/]/,'').gsub(/=/,'!')
return pass if /(?=.*[A-z])(?=.*[0-9])(?=.*[!@#$&*-=])/.match(pass)
@jlavenderrose
jlavenderrose / nodes.pp
Created July 17, 2013 07:07
Very basic LAMP stack (pretty much no configuration) designed to work with https://github.com/mindreframer/vagrant-puppet-librarian
node default {
# Configure mysql
class { 'mysql::server':
config_hash => { 'root_password' => '8ZcJZFHsvo7fINZcAvi0' }
}
include mysql::php
# Configure apache
class {'apache':
default_vhost => false,
%30.29
L=33.5E-2; v=62.7E-2; B=0.269; R=23.3;
V = B*L*v
I = V/R
P = I^2*R
%30.36
Bt = -11.6E-3; r1=21.6E-2; r2=32.0E-2;
P1=Bt*pi*r1^2 * 1E3
%29.57
mu = 1.256E-6; d=4.7E-2; i=4.1; N = 520; B = 7.3E-6;
mud = N*i*(pi*(d/2)^2)
z = ((2*pi*B)/(mu*mud))^(1/3)
%29.29
a=18E-2; i=28; r=[a/2 a/2 0]; mu=1.256E-6;
B = [0 0 0]
R = [[0 a 0] [a a 0] [a 0 0] [0 0 0]];
B = [-2.5E-3 0 0];
v = [0 2710 0];
q = 1.602E-19;
E = 3.66;
F = q*([0 0 E]+cross( v, B));
a = sqrt(dot(F,F))
F = q*([0 0 -E]+cross( v, B));
b = sqrt(dot(F,F))
F = q*([E 0 0]+cross( v, B));
c = sqrt(dot(F,F))
q= 1.602E-19; me=9.109E-31; V1=0.969E3; V2=86.7; d=28.7E-3;
B=-(V2)/d * sqrt(me/(2*V1*q))
q= 1.602E-19; me=9.109E-31; Bc = 0.025; vc=2.2; Vy=16E-3; Vz=10E-3;
B = [Bc 0 0];
Fz = q*cross([0 0 vc],B);
Ez=sqrt(dot(Fz,Fz))/q;
dz = Vz/Ez
Fy = q*cross([0 vc 0],B);
Ey=sqrt(dot(Fz,Fz))/q;
dy = Vy/Ey
q= 1.602E-19; me=9.109E-31; K=4.3E3 * q; B1 = 0.00720; B2 = 0.0238; V = 2100; d=23E-2;
V1 = sqrt((2*K)/(me))
F1 = q*V1*B1
A1 = F1/me
R1 = V1^2/A1
T1 = (pi*R1)/V1
E = V/d
FE = q*E
A2 = FE/me
T2 = (-V1 + sqrt(V1^2 + 4*(.5*A2)*d))/A2