Skip to content

Instantly share code, notes, and snippets.

View alienzj's full-sized avatar
🦀
MAGs lives matter

Jie Zhu alienzj

🦀
MAGs lives matter
View GitHub Profile
{config, pkgs, ...}: let
domain = "hauleth.dev";
mail-domain = "mail.${domain}";
sieve-data = let
stalwart-mail = config.services.stalwart-mail.package;
in pkgs.stdenvNoCC.mkDerivation {
pname = "stalwart-mail-sieve-data";
inherit (stalwart-mail) version src;
dontBuild = true;
pigz -d -c in.fastq.gz |
| awk 'BEGIN {LN=0; } { if (LN == 1 || LN == 3) { print substr($0, 0, 26) } else { print $0 } ; if (LN == 3) { LN = 0 } else { LN++ } }' \
| pigz -c - > out.fastq.gz
@PhilipSchmid
PhilipSchmid / kvm-windows-10-guest-ultrawide-resolution.md
Last active April 26, 2024 17:58
3440x1440 resolution for Windows 10 KVM VM

Configure a Windows 10 KVM Guest to use an ultrawide display resolution (3440x1440)

  1. virsh edit Windows10
  2. Navigate to the <video> section and change it to the following one:
    <video>
      <model type='qxl' ram='131072' vram='131072' vgamem='32768' heads='1' primary='yes'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
@lilydjwg
lilydjwg / colors.py
Last active May 22, 2024 05:17
colors.py: show all kinds of terminal colors at a glance
#!/usr/bin/python3
from functools import partial
def colors16():
for bold in [0, 1]:
for i in range(30, 38):
for j in range(40, 48):
print(f'\x1b[{bold};{i};{j}m {bold};{i};{j} |\x1b[0m', end='')
print()
@SJShaw
SJShaw / combiner.py
Created July 9, 2019 13:07
Combine antiSMASH 5 result JSON files
#!/usr/bin/env python3
import json
import sys
def merge(inputs):
""" Merges the data in the given input handles and returns the result """
assert len(inputs) > 1
record_ids = set()
@MBetters
MBetters / set_kits_env_vars.sh
Last active April 24, 2021 13:46
Script to manually set the environmentVariables of all the kits in VSCode's CMake Tools' .vscode/cmake-kits.json
#!/bin/bash
# Usage: source ./set_kits_env_vars.sh /path/to/your/environment/setup/script
# Prerequisites: jq (sudo apt-get install -y jq)
# This script sources the environment script provided by the given argument
# and sets all the "environmentVariables" fields in .vscode/cmake-kits.json accordingly.
# TODO:
@andy-thomason
andy-thomason / Genomics_A_Programmers_Guide.md
Created May 14, 2019 13:32
Genomics a programmers introduction

Genomics - A programmer's guide.

Andy Thomason is a Senior Programmer at Genomics PLC. He has been witing graphics systems, games and compilers since the '70s and specialises in code performance.

https://www.genomicsplc.com

#pragma once
#include <boost/noncopyable.hpp>
#include <boost/beast/websocket.hpp>
#include <boost/beast/websocket/ssl.hpp>
struct websocket_stream : boost::noncopyable
@edawson
edawson / fastq_splitter.sh
Last active February 5, 2019 14:07
Split a FASTQ (or pair) into 100K read splits using GNU split and pigz. Modified from an original script by @ekg.
first_reads=$1
second_reads=$2
ddir=$(dirname $first_reads)
obase_first=$(basename $first_reads .fastq.gz)
obase_second=$(basename $second_reads .fastq.gz)
splitsz=4000000
if [ ! -z ${first_reads} ] && [ -e ${first_reads} ]
@nadavrot
nadavrot / Matrix.md
Last active May 22, 2024 13:38
Efficient matrix multiplication

High-Performance Matrix Multiplication

This is a short post that explains how to write a high-performance matrix multiplication program on modern processors. In this tutorial I will use a single core of the Skylake-client CPU with AVX2, but the principles in this post also apply to other processors with different instruction sets (such as AVX512).

Intro

Matrix multiplication is a mathematical operation that defines the product of