Skip to content

Instantly share code, notes, and snippets.

View leipzig's full-sized avatar

Jeremy Leipzig leipzig

View GitHub Profile
@shenwei356
shenwei356 / benchmark-encoding.md
Last active August 13, 2022 17:36
k-mer encoding and decoding

Functions:

# encoding: ACTG

def nuc2int_nochecking(b):
    return (ord(b) >> 1) & 3, True
    
def nuc2int_if(b):
    if b == 'a' or b == 'c' or b == 'g' or b == 't' \

or b == 'A' or b == 'C' or b == 'G' or b == 'T':

@mrtns
mrtns / README.md
Last active February 13, 2023 14:26
Data Landscape 2021

201x BI tools

SaaS

Acquired

  • BIME
    • Acquired by Zendesk October 2015
@SuperPaintman
SuperPaintman / npm-f3-install.sh
Last active April 21, 2024 23:41
NPM install for low RAM machins. And "npm install ... killed" problem
#!/bin/bash
#
# Author: SuperPaintman <SuperPaintmanDeveloper@gmail.com>
#
###
# Constants
###
RETVAL=0
@seankross
seankross / hist_and_norm.R
Created March 3, 2016 23:01
Draw normal distribution on histogram of any dataset
# Draw a normal distribution curve on top of a histogram
# of any vector
#
# @param data A numeric vector
hist_and_norm <- function(data){
hist_min <- mean(data) - 4*sd(data)
hist_max <- mean(data) + 4*sd(data)
normalx <- seq(hist_min, hist_max, by = 1)
normaly <- dnorm(normalx, mean = mean(data), sd = sd(data))
@dragonjet
dragonjet / 1-server.md
Last active July 31, 2021 21:01
Setup Web Server on EC2 Amazon Linux AMI

Step 1: Server Credentials

This assumes you are now connected to the server via SSH.

  • sudo -s Enter root mode for admin access
  • groupadd devgroup Create new group to be later granted access to /var/www/html

Creating a new Root User

  • useradd -G root,devgroup masterdev Create new root user. Also add to the devgroup
  • passwd masterdev Change password for the new root user
  • At this point, you'll need to input your new root user's new password
@swarminglogic
swarminglogic / watchfile.sh
Last active March 4, 2024 14:44
watchfile - monitor file(s) and execute a command when files are changed
#!/bin/bash
version=1.0.1
versionDate="2014-02-14"
function showHelp() {
echo "watchfile - monitor file(s)/command and perform action when changed
Possible ways of usage
----------------------------------------
@andrewh
andrewh / anyconnect.scpt
Last active April 12, 2024 08:48
Applescript to automate the Cisco AnyConnect SSL VPN client on OS X Mavericks
-- 1. Place in ~/Library/Scripts and enable the Applescript menu via the Applescript Editor
-- 2. Substitute "vpn.example.com" and "redacted" for your VPN server and password
-- 3. Open Security & Privacy System Preferences, go to Privacy, Accessibility
-- 4. Enable Applescript Editor and System UI Server
-- 5. Trigger script from the menu
-- 6. Enjoy being connected
tell application "Cisco AnyConnect Secure Mobility Client"
activate
end tell
@samuraisam
samuraisam / models.py
Last active February 22, 2019 21:50
Using STS (Security Token Service) to grant access for a federated user to a s3 bucket prefix
import json
import boto
from django.db import models
from django.conf import settings
from django.contrib.auth.models import User
class UploadToken(models.Model):
user = models.ForeignKey(User)
created = models.DateTimeField(auto_now_add=True)
@davidliwei
davidliwei / getinsertsize.py
Last active October 25, 2022 06:15
Estimating NGS paired-end read insert size (or fragment length) from SAM/BAM files
#!/usr/bin/env python
'''
Automatically estimate insert size of the paired-end reads for a given SAM/BAM file.
Usage: getinsertsize.py <SAM file> or samtools view <BAM file> | getinsertsize.py -
Author: Wei Li
Copyright (c) <2015> <Wei Li>