Skip to content

Instantly share code, notes, and snippets.

@shadiakiki1986
shadiakiki1986 / nested_sizeof.py
Last active July 1, 2021 17:35
python get memory size of object
# Recursively get size of objects
# https://stackoverflow.com/a/59228005/4126114
# https://stackoverflow.com/a/38515297/4126114
# Published at https://gist.github.com/shadiakiki1986/6d2b641264b054bc63b224a726a1ead8
def nested_apply(x, func, max_depth, depth_current=0):
s1 = func(x)
if depth_current >= max_depth: return s1
wrap_napply = lambda v: nested_apply(v, func, max_depth, depth_current+1)
@shadiakiki1986
shadiakiki1986 / try-seqacademy.ipynb
Last active November 6, 2023 13:59
try seqacademy.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@shadiakiki1986
shadiakiki1986 / ssh-reverse-tunnel-into-colab-vm.ipynb
Created July 31, 2020 06:13
ssh reverse tunnel into colab VM.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@shadiakiki1986
shadiakiki1986 / mpi3snp-error-on-plink-example.ipynb
Last active July 30, 2020 06:36
mpi3snp error on plink example.ipynb
@shadiakiki1986
shadiakiki1986 / test.cpp
Created July 28, 2020 15:52
show gpu devices with CUDA C++
// from https://github.com/FBerendsen/niftireg/blob/fc526c152fd5eaced271d1d6de7c16661b2abd3e/reg-lib/cuda/checkCudaCard.cpp
//
// rm test
// g++ -I/usr/local/cuda/include -L/usr/local/cuda/lib64 -lcuda test.cpp # undefined reference to cudaGetDeviceCount
// PATH=$PATH:/usr/local/cuda/bin/
// nvcc -x cu test.cpp --std=c++11 -lineinfo -o test
#include <cuda_runtime.h>
//#include <cuda.h>
@shadiakiki1986
shadiakiki1986 / README.md
Last active August 25, 2021 20:52
Download file from gdrive in R, python, bash
@shadiakiki1986
shadiakiki1986 / t3-replicating-plink-epistasis-r.ipynb
Last active March 12, 2020 09:37
t3-replicating plink epistasis.r.ipynb
@shadiakiki1986
shadiakiki1986 / summarize.rs
Last active February 14, 2020 07:29
orbtk example with trait
// Based on https://github.com/redox-os/orbtk/blob/a9653954fed7275328bc8e893c3465506154571e/examples/clear.rs
// Modified to add a trait member called "summary" which is either implemented as a Book or a NewsArticle
// The summarize button would call the trait function "summarize" (be it from Book or NewsArticle).
// I couldn't get this to work yet, with the troubling sections marked with FIXME
use orbtk::prelude::*;
//---------------------------------------
// https://doc.rust-lang.org/1.30.0/book/second-edition/ch10-02-traits.html
pub trait Summary {
+-------------------------+------------------------+---------------------+-----------------+-----------------+-------------+
| . | ImageMagick-6 | NetworkManager | ODBCDataSources | PackageKit | UPower |
+-------------------------+------------------------+---------------------+-----------------+-----------------+-------------+
| adduser.conf | coder.xml | NetworkManager.conf | | PackageKit.conf | UPower.conf |
| anacrontab | colors.xml | conf.d | | Vendor.conf | |
| apg.conf | delegates.xml | dispatcher.d | | | |
| appstream.conf | log.xml | dnsmasq* (2) | | | |
| bash* (2) | magic.xml | system-connections | | | |
| bindresvport.blacklist
@shadiakiki1986
shadiakiki1986 / README.md
Last active January 13, 2020 07:51
Trying out string longest common prefix https://beta.rustgym.com/longest-common-prefix/

Instructions

  • cargo new test-rustgym-longestcommonprefix
  • cd test-rustgym-longestcommonprefix
  • copy src/main.rs from below file
  • cargo test