Skip to content

Instantly share code, notes, and snippets.

View orhanbalci's full-sized avatar

Orhan Balci orhanbalci

View GitHub Profile
@orhanbalci
orhanbalci / kubernetes_in_action.txt
Last active February 14, 2020 05:05
Kubernetes in action commands
//list all namespaces in your cluster
kubectl get ns
//list posd in ns kube-system
kubectl get po --namespace kube-system
//one can use -n instead of --namespace
//one can create a new namspace by using yaml
apiVersion: v1
use std::collections::HashMap;
use nom::named;
use nom::take_while;
use nom::separated_list;
use nom::take_str;
use nom::take;
use nom::is_space;
use nom::types::CompleteByteSlice;
use nom::types::CompleteStr;
#![allow(unused)]
extern crate nom; // 4.2.3
use nom::alpha1;
use nom::alphanumeric;
use nom::alt;
use nom::digit1;
use nom::do_parse;
use nom::eol;
use nom::flat_map;
named!(
ec_value_parser<&[u8],Vec<String>>,
separated_list!(
tag!(","),
map_res!(
map_res!(
take_while!(|c : u8| {c == b'.' || is_digit(c) || is_space(c)}
), str::from_utf8)
named!(
synonym_parser<TokenLine>,
do_parse!(
tag!("COMPND")
>> space1
>> cont: opt!(integer)
>> space0
>> tag!("SYNONYM")
>> tag!(":")
>> space1
@orhanbalci
orhanbalci / pdb_token_chain_parser.rs
Created September 23, 2019 08:12
Parses PDB file COMPND record CHAIN tokens
named!(
chain_value_parser<&[u8],Vec<String>>,
separated_list!(tag!(","), alphanum_word_with_spaces_inside)
);
named!(
chain_parser<TokenLine>,
do_parse!(
named!(
molecule_name_parser<String>,
map_res!(map_res!(take_until!(";"), str::from_utf8), str::FromStr::from_str)
);
named!(
molecule_parser<TokenLine>,
do_parse!(
tag!("COMPND")
named!(
mol_id_parser<Token>,
do_parse!(
tag!("COMPND")
>> take!(2)
>> cont: opt!(twodigit_integer)
>> space0
>> tag!("MOL_ID")
>> tag!(":")
>> space1
#[derive(Debug)]
enum Token {
MoleculeId(i32),
Molecule(String),
Chain { identifiers: Vec<String> },
Fragment(String),
Synonym { synonyms: Vec<String> },
Ec { commission_numbers: Vec<String> },
Engineered(bool),
#[derive(Debug)]
struct Caveat {
continuation: u32,
comment: String,
}
named!(
caveat_parser<Caveat>,
do_parse!(