Skip to content

Instantly share code, notes, and snippets.

View Xjs's full-sized avatar

Jannis Andrija Schnitzer Xjs

View GitHub Profile
@Xjs
Xjs / Bazel and Go.pdf
Last active January 11, 2019 09:46
Bazel and Go
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Xjs
Xjs / bauch.go
Last active December 20, 2019 11:45
BauCH :o)
package main
import (
"fmt"
"math/rand"
"os"
"strings"
"time"
"unicode"
)
@Xjs
Xjs / loop-mock.py
Last active October 11, 2018 10:08
Recursively iterate through parameter spaces
def measure(liste):
if not liste:
nimm_spektrum_auf()
return
param, tail = liste[0], liste[1:] # ich glaub, so kann man des schreiben
name, values = param #jetzt ist name z B. = "magnetfeld" und values die Werte dafür
for v in values:
set(**{name:v})
measure(tail)
import smtplib
msg = """From: <[email protected]>\r\nTo: <[email protected]>\r\n\r\nTest test test test"""
server = smtplib.SMTP('gmail-smtp-in.l.google.com')
server.set_debuglevel(1)
server.sendmail("[email protected]", ["[email protected]"], msg)
server.quit()
@Xjs
Xjs / wasm-table.go
Created August 30, 2018 07:44
Call insertRow() from wasm in Go
package main
import (
"syscall/js"
)
func main() {
document := js.Global().Get("document")
table := document.Call("getElementById", "myTable")
@Xjs
Xjs / exceptionlog
Last active August 29, 2015 14:02
G'n'T stuff
jannis@fsmath seee $ bundle exec irb
1.9.3p194 :001 > require "./web/config/environment.rb"
=> true
1.9.3p194 :002 > m = Postoffice.ankuendigungsmail(1078)
Strahlungstransport in der Erdatmosphäre
ActionView::Template::Error: incompatible character encodings: ASCII-8BIT and UTF-8
from /home/jannis/.rvm/gems/ruby-1.9.3-p194@gnt-eval/gems/activesupport-3.2.11/lib/active_support/core_ext/string/output_safety.rb:135:in `concat'
from /home/jannis/.rvm/gems/ruby-1.9.3-p194@gnt-eval/gems/activesupport-3.2.11/lib/active_support/core_ext/string/output_safety.rb:135:in `concat'
from /home/jannis/.rvm/gems/ruby-1.9.3-p194@gnt-eval/gems/actionpack-3.2.11/lib/action_view/buffers.rb:11:in `<<'
from /home/jannis/seee/web/app/views/postoffice/ankuendigungsmail.de.text.erb:13:in `_app_views_postoffice_ankuendigungsmail_de_text_erb__1759068597082261996_30296460'
@Xjs
Xjs / problem
Last active August 29, 2015 13:56
Ideal gas in an energy landscape
Consider N non-interacting point particles with mass m in a volume V.
The volume is divided into three distinct subvolumes V₁, V₂ and V₃ with V = V₁ + V₂ + V₃.
The particles can move freely between the subvolumes.
The Hamiltonian of the system is
H = H₁(𝔯₁, 𝔭₁) + … + Hᵤ(𝔯ᵤ, 𝔭ᵤ) with Hᵢ = 𝔭ᵢ²/2m + U(𝔯ᵢ) (u = N, unicode lacks a subscript N)
where
@Xjs
Xjs / linked_list.c
Last active December 30, 2015 10:29
A typical linked list, possibly somewhat crudely implemented.
#include <stdio.h>
#include <stdlib.h>
typedef union _data
{
int i;
double d;
void *ptr;
} data_t;
@Xjs
Xjs / himmelblau.c
Last active December 29, 2015 09:19 — forked from anonymous/himmelblau.c
int compare_some_strings (char *a, char *b)
// compare some strings, return -1 if equal, otherwise the position of the first difference.
{
int i;
for (i = 0; a[i] != 0 && b[i] != 0; i++)
if (a[i] != b[i])
return i;
// wenn wir hier angekommen sind, sind sie bis zum Punkt i gleich
if (a[i] == 0 && b[i] == 0) // sie sind ganz gleich
@Xjs
Xjs / schaltjahr.hs
Created October 18, 2012 16:54
schaltjahr
divides :: Int -> Int -> Bool
d `divides` n = n `mod` d == 0
schaltjahr :: Int -> Bool
schaltjahr n | 400 `divides` n = True
| 100 `divides` n = False
| 4 `divides` n = True
| otherwise = False