Skip to content

Instantly share code, notes, and snippets.

View carolinux's full-sized avatar
🤗

Ariadni-Karolina Alexiou carolinux

🤗
  • Zurich
View GitHub Profile
@rbw
rbw / part_of_day.py
Last active October 17, 2022 22:44
Get part of day (morning, afternoon, evening, night) in Python3.6+
#!/usr/bin/env python3
def get_part_of_day(h):
return (
"morning"
if 5 <= h <= 11
else "afternoon"
if 12 <= h <= 17
else "evening"
@tienthanh2509
tienthanh2509 / install-openvpn-24.sh
Last active November 22, 2021 12:29
Install OpenVPN 2.4.x on Ubuntu 16.04 Xenial
curl -s https://swupdate.openvpn.net/repos/repo-public.gpg | apt-key add -
echo "deb http://build.openvpn.net/debian/openvpn/stable xenial main" > /etc/apt/sources.list.d/openvpn-aptrepo.list
apt update
apt install -y openvpn
@mpneuried
mpneuried / Makefile
Last active May 4, 2024 13:46
Simple Makefile to build, run, tag and publish a docker containier to AWS-ECR
# import config.
# You can change the default config with `make cnf="config_special.env" build`
cnf ?= config.env
include $(cnf)
export $(shell sed 's/=.*//' $(cnf))
# import deploy config
# You can change the default deploy config with `make cnf="deploy_special.env" release`
dpl ?= deploy.env
include $(dpl)
@samuell
samuell / reseqtut_lmw.py
Last active October 3, 2016 12:29
Some steps from the the Re-sequencing NGS intro tutorial [1], using Luigi workflow system [2] with the Luigi's Monkey Wrench [3] wrapper. (Refs: [1]: http://uppnex.se/twiki/do/view/Courses/NgsIntro1502/ResequencingAnalysis.html [2]: https://github.com/spotify/luigi [3]: https://github.com/samuell/luigis_monkey_wrench )
import luigi
from luigis_monkey_wrench import *
REF='human_17_v37.fasta'
INDIVIDUALS=['NA06984','NA07000']
SAMPLES=['1','2']
BASENAME='.ILLUMINA.low_coverage.17q_'
PICARDDIR='/sw/apps/bioinfo/picard/1.69/kalkyl/'
KNOWNSITES='/proj/g2014207/labs/gatk/ALL.chr17.phase1_integrated_calls.20101123.snps_indels_svs.genotypes.vcf'
@lossyrob
lossyrob / write-one-line-text.scala
Last active August 14, 2019 07:54
Read \ Write a text file in one line Scala
def write(path: String, txt: String): Unit = {
import java.nio.file.{Paths, Files}
import java.nio.charset.StandardCharsets
Files.write(Paths.get(path), txt.getBytes(StandardCharsets.UTF_8))
}
def read(path: String): String =
scala.io.Source.fromFile(path, "UTF-8").getLines.mkString
KV_KEY = 'forecast-alert-datapoint'
module.exports = (robot) ->
postWeatherAlert = (json, callback) ->
postMessage = callback
now = new Date()
# This function posts an alert about the current forecast data always. It
# doesn't determine if the alert should be posted.
@hongkongkiwi
hongkongkiwi / redis-ip-update.sh
Last active January 9, 2017 08:31
Update Redis Config file with Private IP Address
#!/bin/bash
IP_ADDRESS=`ifconfig eth1 | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1'`
sed -i "s/bind 127.0.0.1/bind ${IP_ADDRESS} 127.0.0.1/g" /etc/redis/redis.conf
@Nicksil
Nicksil / gist:5646003
Created May 24, 2013 19:40
Python - Knuth-Morris-Pratt (KMP) string-matching algorithm
# File: KnuthMorrisPratt.py
# Author: Keith Schwarz (htiek@cs.stanford.edu)
#
# An implementation of the Knuth-Morris-Pratt (KMP) string-matching algorithm.
# This algorithm takes as input a pattern string P and target string T, then
# finds the first occurrence of the string T in the pattern P, doing so in time
# O(|P| + |T|). The logic behind the algorithm is not particularly complex,
# though getting it to run in linear time requires a few non-obvious tricks.
#
# To motivate KMP, consider the naive algorithm for trying to match a pattern