Skip to content

Instantly share code, notes, and snippets.

@nuin
nuin / CouchDB_Python.md
Created January 22, 2023 02:13 — forked from marians/CouchDB_Python.md
The missing Python couchdb tutorial

This is an unofficial manual for the couchdb Python module I wish I had had.

Installation

pip install couchdb

Importing the module

@nuin
nuin / pre-push.sh
Created January 22, 2023 02:13 — forked from vlucas/pre-push.sh
Prevent Pushes Directly to Master
#!/bin/bash
# @link https://gist.github.com/mattscilipoti/8424018
#
# Called by "git push" after it has checked the remote status,
# but before anything has been pushed.
#
# If this script exits with a non-zero status nothing will be pushed.
#
# Steps to install, from the root directory of your repo...
@nuin
nuin / 00_Makefile_LaTeX_README.md
Created January 29, 2022 02:40 — forked from tueda/00_Makefile_LaTeX_README.md
Makefile for LaTeX documents. #make #latex

This project is superceded by makefile4latex.

Makefile for LaTeX

This is a GNU Makefile for typesetting LaTeX documents. Expected to work with TeXLive on Linux (and similar systems, e.g., on Cygwin). Just download Makefile and put it in a directory that contains your LaTeX files. Running make will generate PDF files for you:

@nuin
nuin / pocketdedupe.py
Created April 18, 2017 20:03 — forked from Mierdin/pocketdedupe.py
A Python script to intelligently remove duplicate entries from Pocket
#!/usr/bin/env python
from pocket import Pocket
import webbrowser, sys
# Get consumer key from cmd line
consumer_key = sys.argv[1]
request_token = Pocket.get_request_token(
consumer_key=consumer_key,
@nuin
nuin / ssh_client.py
Created September 29, 2016 20:26 — forked from ghawkgu/ssh_client.py
Python ssh client sample
#!/usr/bin/env python
import paramiko
hostname = 'localhost'
port = 22
username = 'foo'
password = 'xxxYYYxxx'
if __name__ == "__main__":
@nuin
nuin / useful_pandas_snippets.py
Created May 4, 2016 16:46 — forked from bsweger/useful_pandas_snippets.md
Useful Pandas Snippets
#List unique values in a DataFrame column
pd.unique(df.column_name.ravel())
#Convert Series datatype to numeric, getting rid of any non-numeric values
df['col'] = df['col'].astype(str).convert_objects(convert_numeric=True)
#Grab DataFrame rows where column has certain values
valuelist = ['value1', 'value2', 'value3']
df = df[df.column.isin(value_list)]
@nuin
nuin / matplotlibrc
Created June 18, 2012 20:18 — forked from huyng/matplotlibrc
my default matplotlib settings
### MATPLOTLIBRC FORMAT
# This is a sample matplotlib configuration file - you can find a copy
# of it on your system in
# site-packages/matplotlib/mpl-data/matplotlibrc. If you edit it
# there, please note that it will be overridden in your next install.
# If you want to keep a permanent local copy that will not be
# over-written, place it in HOME/.matplotlib/matplotlibrc (unix/linux
# like systems) and C:\Documents and Settings\yourname\.matplotlib
# (win32 systems).
"""
PWMSearch
Searches through a fasta sequence for the relevant Position Weight Matrices
from the Jaspar Database.
"""
from __future__ import division
from optparse import OptionParser
def parse_color(s):
""" Parses color string in format #ABC or #AABBCC to RGB tuple. """
g = len(s)
assert(g in (4,5,7,9))
if g in (4,5):
return tuple(int(ch * 2, 16) for ch in s[1:])
else:
return tuple(int(ch1 + ch2, 16) for ch1, ch2 in \
zip(
#!/usr/bin/ruby
# save as pubmed.rb and test using 'ruby pubmed.rb 19662644'
# keyword search may return > 1 record due to retmax bug
# http://github.com/bioruby/bioruby/commit/51c3223e033b2992a7bd95da282f88164406ff92
require 'rubygems'
require 'bio'
keywords = ARGV.join(' ')