Skip to content

Instantly share code, notes, and snippets.

View gmic's full-sized avatar

Gerhard Messelink gmic

  • GMIC
  • Netherlands
View GitHub Profile
@gmic
gmic / gist:c5dea8eab4579b512d878639e91f7a84
Created June 20, 2018 07:29
Install kubernetes helm 2.6.1
cd "$(brew --repo homebrew/core)"
brew unlink kubernetes-helm
vi Formula/kubernetes-helm.rb
# change following lines for 2.6.1
:tag => "v2.6.1",
:revision => "bbc1f71dc03afc5f00c6ac84b9308f8ecb4f39ac"
....
sha256 "a030c0ea9f980cdd4523b4cab0f013bec529ce6225117492c55a924871163bb7" => :high_sierra
HOMEBREW_NO_AUTO_UPDATE=1 brew install kubernetes-helm
ps -ef | grep run | grep -v grep| grep airflow | awk '{print $2}' | xargs kill
@gmic
gmic / cat.py
Created April 5, 2017 09:20
Pipe subprocess to output file
my_cmd = ['cat'] + input_files
with open('myfile', "w") as outfile:
subprocess.call(my_cmd, stdout=outfile)
@gmic
gmic / rJava.sh
Created April 4, 2017 07:16
Fix java for R
# Fix java for R
R CMD javareconf
ln -f -s $(/usr/libexec/java_home)/jre/lib/server/libjvm.dylib /usr/local/lib
@gmic
gmic / task.yml
Created February 4, 2017 08:48
Task filter for host group
- name: Example task only run for hosts in the group vagrant
debug: msg="I'm a vagrant box"
when: "vagrant" in group_names
- name: Example task only run for hosts *not* in the group vagrant
debug: msg="I'm not in the vagrant group.. sad panda :("
when: "vagrant" not in group_names
@gmic
gmic / SshSensorOperaror.py
Created January 26, 2017 12:06
Airflow ssh sensor
class SshSensorOperator(SSHExecuteOperator, BaseSensorOperator):
"""
Wait for some ssh command to succeed.
"""
count = 0
def poke(self, context):
"""
Function that checks for ssh command.
"""
beeline -u "$KETL_JDBC_HIVE_URI" --hivevar bla=1 --hivevar ketl_env="${KETL_ENV}" -e "select 'hi\${hivevar:bla}: \${hivevar:ketl_env}';"
@gmic
gmic / jython_install.sh
Created April 18, 2016 12:54
Add jython as virtualenv on Mac
# Add jython as virtualenv on Mac
brew install jython
virtualenv -p /usr/local/bin/jython jython-env --no-setuptools
. ./jython-env/bin/activate
wget https://bootstrap.pypa.io/ez_setup.py
python ez_setup.py --insecure
@gmic
gmic / report.sql
Created January 6, 2016 15:02
SQL report template
set echo off
set embedded on
set feedback off
set heading off
set linesize 2000
set pages 0
set recsep off
set termout off
set trim on
set trimspool on
@gmic
gmic / nslookup.py
Last active September 11, 2018 01:05
Python nslookup
import subprocess
process = subprocess.Popen(["nslookup", "www.google.com"], stdout=subprocess.PIPE)
output = process.communicate()[0].split('\n')
ip_arr = []
for data in output:
if 'Address' in data:
ip_arr.append(data.replace('Address: ',''))