Skip to content

Instantly share code, notes, and snippets.

View jamesholcomb's full-sized avatar

James Holcomb jamesholcomb

View GitHub Profile
import React, {Component} from "react";
import {Animated, Dimensions, Platform, Text, View} from 'react-native';
import {Body, Header, List, ListItem as Item, ScrollableTab, Tab, Tabs, Title} from "native-base";
const NAVBAR_HEIGHT = 56;
const {width: SCREEN_WIDTH} = Dimensions.get("window");
const COLOR = "rgb(45,181,102)";
const TAB_PROPS = {
tabStyle: {width: SCREEN_WIDTH / 2, backgroundColor: COLOR},
activeTabStyle: {width: SCREEN_WIDTH / 2, backgroundColor: COLOR},
@jamesholcomb
jamesholcomb / node_modules_space.sh
Created January 18, 2018 15:52
Recursively finds the disk space used by folders named 'node_modules'
find . -name 'node_modules' -type d -prune -exec du -sh {} +
@jamesholcomb
jamesholcomb / kshell
Last active March 13, 2018 21:33 — forked from Stono/kshell
A shell script which enables easy execing into kube pods
#!/bin/sh
if [ "$1" = "" ]; then
echo "Usage: ./ksh <pod>"
exit 1
fi
echo Getting pods...
PODS=$(kubectl get pods --no-headers --output=name | grep $1)
PODS=(${PODS})
NUM_PODS=${#PODS[@]}
@jamesholcomb
jamesholcomb / script.sh
Last active March 21, 2018 13:32
Finds the folders which contain a node_modules folder
find . -name node_modules -type d -maxdepth 2
@jamesholcomb
jamesholcomb / .bash_profile
Created October 6, 2018 20:46
bash_profile
export PATH=$(brew --prefix coreutils)/libexec/gnubin:/usr/local/bin:/usr/local/sbin:$PATH
export GOPATH=$HOME/go
export LSCOLORS=gxBxhxDxfxhxhxhxhxcxcx
export CLICOLOR=1
alias k=kubectl
alias cat=bat
alias preview="fzf --preview 'bat --color \"always\" {}'"
# add support for ctrl+o to open selected file in VS Code
@jamesholcomb
jamesholcomb / print-master.sh
Created February 22, 2019 03:31
outputs the mongodb replica set master host name in a Kubernetes cluster
kubectl exec db-mongodb-replicaset-0 -- sh -c 'mongo --quiet --eval="printjson(rs.isMaster().primary)"' | sed 's/"//g' | awk -F\. '{print $1}'
@jamesholcomb
jamesholcomb / initials.js
Last active April 8, 2019 20:28
Perform a best effort extraction of up to two initials from a space delimited name string
/**
* Perform a best effort extraction of up to two initials from a space delimited name string
* @param {string} text The text
* @return {string} The result
*/
function initials(text) {
if (!text) {
return ""
}
@jamesholcomb
jamesholcomb / ContactsSectionList.js
Created May 21, 2019 14:53
React Native SectionList for contacts
import React, { Component, PureComponent } from "react"
import PropTypes from "prop-types"
import {
StyleSheet,
View,
Text,
ViewPropTypes,
TouchableWithoutFeedback,
SectionList
} from "react-native"
@jamesholcomb
jamesholcomb / script.sh
Last active September 12, 2019 21:13
Disable fluentd-gcp on a Kubernetes node
# disable stackdriver logging in the cluster
gcloud beta container clusters update [CLUSTER_NAME] --logging-service none
# delete the label on the specific node
kubectl label nodes [NODE_NAME] beta.kubernetes.io/fluentd-ds-ready-
# apply config
kubectl apply -f https://raw.githubusercontent.com/GoogleCloudPlatform/kubernetes-engine-customize-fluentd/master/kubernetes/fluentd-configmap.yaml
# apply daemonset
kubectl apply -f https://raw.githubusercontent.com/GoogleCloudPlatform/kubernetes-engine-customize-fluentd/master/kubernetes/fluentd-daemonset.yaml
@jamesholcomb
jamesholcomb / script.sh
Last active January 24, 2020 17:18
mongoimport geonames US zip codes
# https://download.geonames.org/export/zip/US.zip
mongoimport -d mydb -c zipcodes \
--columnsHaveTypes --type tsv --file US.txt \
--stopOnError --drop \
--fields="countryCode.string(),postalCode.string(),placeName.string(),adminName1.string(),adminCode1.string(),adminName2.string(),adminCode2.string(),adminName3.string(),adminCode3.string(),latitude.double(),longitude.double(),accuracy.string()"