Skip to content

Instantly share code, notes, and snippets.

blabadi

Block or report user

Report or block blabadi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@blabadi
blabadi / vault-k8s.md
Last active Jun 19, 2019
setup kubernetes vault in
View vault-k8s.md
@blabadi
blabadi / install-k8s-ubuntu.sh
Created Jun 17, 2019 — forked from jogy/install-k8s-ubuntu.sh
Installing a single node Kubernetes on Ubuntu with kubeadm
View install-k8s-ubuntu.sh
# 1) Install Kubernetes on a Ubuntu machine
sudo -i
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
echo 'deb http://apt.kubernetes.io/ kubernetes-xenial main' >> /etc/apt/sources.list.d/kubernetes.list
apt update && apt install -y docker.io kubelet kubeadm kubectl
sudo systemctl enable docker.service
kubeadm init --pod-network-cidr=10.244.0.0/16 # Flannel pod network, see below
exit
# 2) Prepare kubectl
@blabadi
blabadi / javaPropsToK8sEnvArray.js
Last active May 10, 2019
a script to convert java properties into env vars instead of manually typing them, it takes into account arrays in keys. the output format is specifically useful for kubernetes yaml env object
View javaPropsToK8sEnvArray.js
const convertJavaPropertiesToEnvVars = function(configs) {
const configLines = configs.split('\n');
let out = ''
for (let idx in configLines) {
const line = configLines[idx]
const key = line.split('=')[0].toUpperCase()
.replace(/\[/g, '.')
.replace(/\]/g, '')
.replace(/\./g, '_')
const value = line.split('=')[1]
View black_slack.css
body { background: #222; color: #e6e6e6; }
a { color: #949494; }
a:link, a:visited { color: #949494; }
a:hover, a:active, a:focus { color: #c7c7c7; }
hr { border-bottom: 1px solid #424242; border-top: 1px solid #222; }
View gensim.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View reducer.js
import {SEARCH_FOOD, RECEIVE_SEARCH_FOOD_RESULTS} from "../actions/searchFoodActions";
const searchFoodResult = (state = { isFetching: false, term: '', results: [] }, action) => {
switch (action.type) {
case SEARCH_FOOD:
return Object.assign({}, state, {
isFetching: true,
term: action.term
});
View searchFoodActions.js
import foodRepo from '../repos/FoodRepo';
export const SEARCH_FOOD = 'SEARCH_FOOD';
export const RECEIVE_SEARCH_FOOD_RESULTS = 'RECEIVE_SEARCH_FOOD_RESULTS'
export const fetchFood = (term) => {
return (dispatch) => {
dispatch(searchFood);
return foodRepo.findFood(term)
.then(foods => {
View index.js
import { combineReducers } from 'redux'
import searchFoodResult from './search'
const nutracker = combineReducers({
searchFoodResult
})
export default nutracker
View SearchFood.js
import SearchBox from '../presentational/search/SearchBox';
import {searchFood} from '../actions'
import {connect} from 'react-redux';
const mapDispatchToProps = dispatch => ({
onTermChange: term => dispatch(searchFood(term))
})
const mapStateToProps = (state) => {
return {
View Dashboard.jsx
import React, {Component} from 'react';
import SearchBox from '../components/search/SearchBox';
import {instance as foodRepo} from '../repos/FoodRepo'
class Dashboard extends Component {
state = {
searchResults: []
}
onTermChange = (term) => {
console.log(term);
You can’t perform that action at this time.