Skip to content

Instantly share code, notes, and snippets.

View viklund's full-sized avatar
:octocat:
Always be gitin'

Johan Viklund viklund

:octocat:
Always be gitin'
View GitHub Profile
@viklund
viklund / 00_init_k3d.sh
Last active December 10, 2019 10:16
Simple LocalEGA Helm setup
#!/usr/bin/env bash
source _script_source.sh
set -e
has_traefik_pods() {
L=$(kubectl get pods -n kube-system -lapp=svclb-traefik 2>/dev/null | wc -l)
if [ $L -eq 0 ]; then
false
else
true
@viklund
viklund / Dockerfile
Last active December 3, 2019 13:37
Crypt4gh docker experiments
FROM debian:10-slim
## Otherwise Java won't install
RUN mkdir -p /usr/share/man/man1
RUN apt-get update \
&& apt-get install -y gnupg2
## This is to get openjdk-11-jre to install on -slim
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EA8CACC073C3DB2A
#!/usr/bin/env perl
use strict;
use warnings;
my %stats = (
'+' => { qw/comment 0 whitespace 0 code 0/ },
'-' => { qw/comment 0 whitespace 0 code 0/ },
);
<html>
<head>
<style>
div.q, div.a {
float: left;
width: 4.0em;
font-size: 14pt;
margin-bottom: 1em;
}
// Hack nextflow workflow that removes intermediate files generated
// by process A once process B is done with the files
inputA = Channel.from(
[1, file('f1')],
[2, file('f2')],
[3, file('f3')],
[4, file('f4')],
[5, file('f5')])
#!/usr/bin/env bash
## Backup clone
git clone git@github.com:NBISweden/LocalEGA.git LocalEGA-backup-$(date +"%Y-%m-%d_%H:%M:%S")
## Clone it
[ -d LocalEGA-cleaning ] && rm -rf LocalEGA-cleaning
git clone git@github.com:NBISweden/LocalEGA.git LocalEGA-cleaning
cd LocalEGA-cleaning
#!/bin/bash
MYSQL_PORT=3366
MYSQL_HOST=127.0.0.1
MYSQL_PASS=rootpw
# Start a mysql instance with docker for example like this:
docker volume create swefreq-mysql-data
docker run -v swefreq-mysql-data:/var/lib/mysql --rm --name mysql -e MYSQL_ROOT_PASSWORD=$MYSQL_PASS -d -p $MYSQL_PORT:3306 mysql
import markovify
import json
import os
users = json.load(open('slack/users.json'))
user = ''
for u in users:
if u['name'] == 'viklund':
user = u['id']
@viklund
viklund / number_of_commits.rb
Created October 16, 2017 13:49
Number of commits per repo on the NBISweden github repo
#!/usr/bin/env ruby
require 'octokit'
require 'set'
def repo_name(repo)
return ORG + "/" + repo[:name]
end
ORG = "NBISweden"
$ awk '$4>50 && $3>90 && F[$1]++ < 1{print}' blast_result
$4 is column 4 i.e. length, larger than 50bp
$3 percent identity bigger than 90
F[$1]++ < 1 is the tricky part. We count upwards for each query we find and as long as the number
is less than 1 it is true, since the ++ is after the F[$1] the value will be zero the first time
and 1 the second time and so on.