Skip to content

Instantly share code, notes, and snippets.

View sanmai's full-sized avatar

Alexey Kopytko sanmai

View GitHub Profile
@sanmai
sanmai / merge_dna_files.rb
Created August 15, 2022 02:54 — forked from plashchynski/merge_dna_files.rb
Tool to merge 23andme and Ancestory.com raw dna files
#!/usr/bin/ruby
#
# Usage:
# ruby ./merge_dna_files.rb file,file1,file2... > merged_file.txt
#
# Example:
# ruby ./merge_dna_files.rb AncestryDNA.txt genome_John_Doe_v4_Full_20170428065226.txt > merged_raw.txt
#
# Supports 23andMe, AncestryDNA, and Genes for Good 23andMe compatible file formats.
# The result will be in 23andMe file format.
# add to .profile
set-title () {
# If the length of string stored in variable `PS1_BAK` is zero...
# - See `man test` to know that `-z` means "the length of STRING is zero"
if [[ -z "$PS1_BAK" ]]; then
# Back up your current Bash Prompt String 1 (`PS1`) into a global backup variable `PS1_BAK`
PS1_BAK="$PS1"
fi
@sanmai
sanmai / Count Code lines.sh
Created October 5, 2020 05:16 — forked from amitchhajer/Count Code lines
Count number of code lines in git repository per user
git ls-files | xargs -n1 git blame --line-porcelain | sed -n 's/^author //p' | sort -f | uniq -ic | sort -nr
@sanmai
sanmai / WP REST API Controller Class.php
Last active September 25, 2020 08:14 — forked from JMWebDevelopment/WP REST API Controller Class
This is the base WP REST API Controller class
<?php class Sports_Bench_Team_REST_Controller extends WP_REST_Controller {
/**
* Register the routes for the objects of the controller.
*/
public function register_routes() {
$namespace = 'sportsbench';
$base = 'teams';
register_rest_route( $namespace, '/' . $base, array(
array(
@sanmai
sanmai / isset_vs_array_key_exists.php
Last active March 20, 2020 03:16 — forked from alcaeus/in_array_vs_isset_vs_array_key_exists.php
Performance comparision: isset vs. array_key_exists
<?php
function testPerformance($name, Closure $closure, $runs)
{
$start = microtime(true);
for (; $runs > 0; $runs--)
{
$_ = $closure();
}
$end = microtime(true);
@sanmai
sanmai / example.txt
Last active April 20, 2019 15:12
Signed file example
Example

Keybase proof

I hereby claim:

  • I am sanmai on github.
  • I am sanmai (https://keybase.io/sanmai) on keybase.
  • I have a public key ASAEQqjFdv38mOryXsV-joWg1qDmcWwQr5mtqYaih13nDAo

To claim this, I am signing this object:

MAKEFLAGS+=j2
all:
@echo $(MAKEFLAGS)
@sanmai
sanmai / README.md
Last active October 30, 2018 01:09