Skip to content

Instantly share code, notes, and snippets.

@michaelgugino
michaelgugino / gist:554db0656cd1b5a21da22da58bf5af99
Created April 14, 2016 18:10
How to build anything with cython
#mylib.pyx
import pandas as pd
df = pd.DataFrame({ 'A' : 1.,
'B' : pd.Timestamp('20130102'),
'C' : pd.Series(1, index=list(range(4)), dtype='float32'),
'D' : pd.Series([1, 2, 1, 2], dtype='int32'),
'E' : pd.Categorical(["test", "train", "test", "train"]),
'F' : 'foo' })
import setuptools
import sys, io, os, glob
from setuptools import setup, find_packages, Extension
# In python < 2.7.4, a lazy loading of package `pbr` will break
# setuptools if some other modules registered functions in `atexit`.
# solution from: http://bugs.python.org/issue15881#msg170215
try:
import multiprocessing # noqa
except ImportError:
/*
Demo json + libcurl cpp program
Copyright (C) 2016 Michael Gugino
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
https://askubuntu.com/questions/515407/how-recipe-to-build-only-one-kernel-module
parent:
{% for item in childern %}
name: {{ item.name }}
port: {% if item.proto == 'https' %}443{% else %}80{% endif %}
things:
{% for t in item.things %}
- prepend-something{{ t }}
{% endfor %}
---
- name: test
hosts: all
tasks:
- command: echo "something ran"
delegate_to: host1
run_once: True
register: echores
- debug: var=echores
[OSEv3:children]
masters
nodes
etcd
[OSEv3:vars]
ansible_ssh_user=fedora
ansible_python_interpreter=/usr/bin/python3
become=True
openshift_deployment_type=origin
@michaelgugino
michaelgugino / vars_baby.yml
Created April 4, 2018 16:50
Use the vars!
- name: do x
x:
something: "{{ l_do_x_var }}"
vars:
l_do_x_default: "{{ big_ugly_registered_var.stat.something[1] }}"
l_do_x_var: "{{ my_inventory_var | default(l_do_x_default) }}"
@michaelgugino
michaelgugino / better.yml
Last active April 11, 2018 18:20
Something better than what I was given.
- hosts: all # Never a good idea to use all group unless testing
sudo: yes # don't do this, use inventory to set the ansible_become=True variable.
tasks:
- name: Cat inputs out of splunk in opt
slurp:
src: "{{ splunk_inputs_file }}"
register: splunk_inputs_file_slurp
when:
- ansible_distribution == 'RedHat'
@michaelgugino
michaelgugino / version_compare.sh
Created May 15, 2018 20:05
All bash version compare
#!/bin/bash
xxx="go1.18.3"
xxx2="go1.10.2"
str_to_array() {
local IFS='.'
local NEW_ARRAY=(0 0 0 0)
local version_part_index=0
for i in $1; do