Skip to content

Instantly share code, notes, and snippets.

View PhilipVinc's full-sized avatar
🎯
Solving problems...

Filippo Vicentini PhilipVinc

🎯
Solving problems...
View GitHub Profile
@PhilipVinc
PhilipVinc / ast_plotting.jl
Last active March 7, 2019 19:44
Create a MetaGraphs description of the AST of a function and displays it
using LightGraphs, MetaGraphs, GraphPlot, DataStructures
# Create the structures I need...
function create_graph()
mg = MetaDiGraph(DiGraph())
stack = Stack{Any}()
ssastack = Stack{Any}()
# Add a dictionary holding all global references
set_prop!(mg, :global_refs, Dict())
using Distributed, Random
addprocs(3)
@everywhere module Test
using Distributed, Random
# My custom weight class, a vector with a couple of views into itself
struct Weights{T} <: AbstractVector{T}
weights::Vector{T}
a::AbstractVector{T}
using DifferentialEquations
L = 4;
U=0.1; Δ=0.1; J=0.45; F=1.57;
u₀ = fill(0.2+0.2im, L, 1);
Jmat = J.*(diagm(linspace(1,1,L-1),1)+diagm(linspace(1,1,L-1),-1));
function ff(dα,α,p,t)
dα[:] = (-im*(Δ - U*(α .* conj(α) - 1.0)) - 1/2.0).*α + im*F -im.*(Jmat*α);
end
function gg(dα, α, p, t)
class C(object):
def __init__(self, i, n):
self.i = i
self.n = n
self.psi0 = []
self.tlist = []
def qubit_integrate(self, epsilon, delta, g1, g2, solver):
import qutip
#!/bin/bash
SOURCE_DIR=/home/niklas/
TARGET_DIR=/media/Backup/FileBackup
EXCLUDE_FILE=/home/niklas/rsync_excludelist
rsync -avP --exclude-from=${EXCLUDE_FILE} --delete-excluded --delete --stats ${SOURCE_DIR} ${TARGET_DIR}
# add log entry to target dir
LOGFILE="$TARGET_DIR/backup_log"
DATE=$(date)
echo "Last backup on $DATE" >> $LOGFILE