Skip to content

Instantly share code, notes, and snippets.

@shadiakiki1986
shadiakiki1986 / ssh-reverse-tunnel-into-colab-vm.ipynb
Created July 31, 2020 06:13
ssh reverse tunnel into colab VM.ipynb
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
@shadiakiki1986
shadiakiki1986 / spinner.sh
Created January 3, 2020 09:10
Display spinner in bash
#!/bin/bash
# from https://raw.githubusercontent.com/golemfactory/golem/develop/Installer/Installer_Linux/install.sh
# Usage: bash spinner.sh
spin='⡄⡆⡇⠇⠃⠋⠉⠙⠘⠚⠒⠖⠆⠦⠤⢤⢠⣠⣀⣄'
printf "hey there .. working "
while true
do
@shadiakiki1986
shadiakiki1986 / example_1.txt
Last active October 4, 2023 08:53
aws cli cloudtrail + jq examples
# list latest 10 event names and the next token
aws cloudtrail lookup-events \
--max-items 10 \
--lookup-attributes AttributeKey=EventSource,AttributeValue=ec2.amazonaws.com \
--lookup-attributes AttributeKey=ReadOnly,AttributeValue=false \
--starting-token "eyJOZXh0VG9rZW4iOiBudWxsLCAiYm90b190cnVuY2F0ZV9hbW91bnQiOiAxMH0=" | \
jq '.Events[].EventName,.NextToken'
"ModifyInstanceAttribute"