Skip to content

Instantly share code, notes, and snippets.

View mwalzer's full-sized avatar

Mathias Walzer mwalzer

  • EMBL-EBI
  • Cambridge
View GitHub Profile
import os
from hurry.filesize import size, si
filename = "test.txt"
limit = 1000000
var = "filenames.wiff"
with open(filename, 'w') as out:
for f in range(0,limit):
out.write(var + '\n')
s = os.path.getsize("/tmp/{x}".format(x=filename))
/**
* Will add events per row from a spreadsheet in a calendar.
*
* Events are expected to start being described from row 'startRow' on,
* having the time in the first column in HH:MM format (full 24h!), the name of the event in
* second column (empty entries will make the row being ignored), and third and fourth column
* values added each as a line in the event description.
*/
function createCalendarEvent() {
var sheet = SpreadsheetApp.getActiveSheet();
@mwalzer
mwalzer / multi_file.json
Created September 20, 2018 14:06
just a draft exploring different representations
#1
"content": {
"_cvRef": "PSI-QC-CV",
"_accession": "QC:301_filespanning",
"_value": "{'filenames':[rawfile001,rawfile002,rawfile003,rawfile004,rawfile005],'MS:1000043':[123,456,789,666,901]}"
},
#2
"content": {
"_cvRef": "PSI-QC-CV",
@mwalzer
mwalzer / minikube.helm.sh
Last active May 4, 2018 13:23
get a minikube environment to play
#hypervisor requirements ...
# --vm-driver=none if docker is installed might be enough
#kubectl
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl && chmod +x kubectl && sudo mv kubectl ~/cloud-stuff/utils/
#minikube
curl -Lo minikube https://github.com/kubernetes/minikube/releases/download/$(curl -s "https://api.github.com/repos/kubernetes/minikube/releases/latest" | grep -Po '"tag_name": "\K.*?(?=")')/minikube-linux-amd64 && chmod +x minikube-linux-amd64 && sudo mv minikube-linux-amd64 ~/cloud-stuff/utils/minikube
#launch
@mwalzer
mwalzer / Dockerfile
Last active May 28, 2018 14:20
windows dockerfile with container for pwiz instructions
FROM microsoft/dotnet-framework:3.5
#FROM microsoft/windowsservercore:10.0.14393.206
#WTF? seems .net 35 is not activated
SHELL ["powershell"]
COPY pwiz c:/pwiz/
COPY 06282014_JLB_UF_Run3.raw c:/temp/06282014_JLB_UF_Run3.raw
# Note: Add .NET + ASP.NET
library(ggplot2)
# ggpie: draws a pie chart.
# give it:
# * `dat`: your dataframe
# * `by` {character}: the name of the fill column (factor)
# * `totals` {character}: the name of the column that tracks
# the time spent per level of `by` (percentages work too).
# returns: a plot object.
#credit http://mathematicalcoffee.blogspot.co.uk/2014/06/ggpie-pie-graphs-in-ggplot2.html
@mwalzer
mwalzer / init-test-pod-only.yaml
Created February 12, 2018 11:08
creates a k8s pod mounting a pvc (must be bound already)
apiVersion: v1
kind: Pod
metadata:
name: init-test-pod-only
spec:
containers:
- name: svn-pod
image: mwalzer/alpine-svn
imagePullPolicy: IfNotPresent
# container will "crash" if no command is present as there is no default entrypoint as e.g. would be in nginx
@mwalzer
mwalzer / textexporter2msstats.R
Last active March 13, 2017 20:52
OpenMS_TextExporter2MSstat
library(ggplot2)
library(dplyr)
library(tidyr)
msstats<- peptides.lfq.tutorial
# Assume cf_charge as PrecursorCharge for all features in one row of TextExporter output
msstats <- msstats %>% rename(PrecursorCharge=charge_cf)
# Drop useless cols
<?xml version="1.0" encoding="ISO-8859-1"?>
<PARAMETERS version="1.3" xsi:noNamespaceSchemaLocation="http://open-ms.sourceforge.net/schemas/Param_1_3.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<NODE name="info" description="">
<ITEM name="version" value="1.9.0" type="string" description="" />
<ITEM name="num_vertices" value="10" type="int" description="" />
<ITEM name="num_edges" value="10" type="int" description="" />
<ITEM name="description" value="&lt;![CDATA[&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:&apos;Arial&apos;; font-size:12pt; font-weight:400; font-style:normal;&quot;&gt;
<?xml version="1.0" encoding="ISO-8859-1"?>
<PARAMETERS version="1.3" xsi:noNamespaceSchemaLocation="http://open-ms.sourceforge.net/schemas/Param_1_3.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<NODE name="info" description="">
<ITEM name="version" value="1.9.0" type="string" description="" />
<ITEM name="num_vertices" value="9" type="int" description="" />
<ITEM name="num_edges" value="8" type="int" description="" />
<ITEM name="description" value="&lt;![CDATA[&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:&apos;Arial&apos;; font-size:12pt; font-weight:400; font-style:normal;&quot;&gt;