Skip to content

Instantly share code, notes, and snippets.

View mehiel's full-sized avatar
💭
Plugged 🔌

Aggelos Karalias mehiel

💭
Plugged 🔌
View GitHub Profile
@mehiel
mehiel / ambari201-debian9.md
Last active December 19, 2020 13:55
Ambari v2.0.1 and Debian Stretch

Ambari-Server Debian troubleshooting

Install java8 on all nodes

apt-get install openjdk-8-jdk

echo "export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64" > /etc/profile.d/Z99-java-env.sh

source /etc/profile.d/Z99-java-env.sh

@mehiel
mehiel / ReactStatelessForm.js
Last active December 22, 2016 03:42
A proof-of-concept stateless form in react
import ReactDOM from 'react-dom'
import { PropTypes } from 'react'
import map from 'ramda/src/map'
import toPairs from 'ramda/src/toPairs'
import compose from 'ramda/src/compose'
import propOr from 'ramda/src/propOr'
import curry from 'ramda/src/curry'
const { string, object, func } = PropTypes
@mehiel
mehiel / crud.js
Created February 10, 2017 09:50
CRUD helpers for redux
import createAction from 'redux-actions/lib/createAction'
import { create, read, update, destroy, params } from 'utils/xhr'
import always from 'ramda/src/always'
import assoc from 'ramda/src/assoc'
import compose from 'ramda/src/compose'
import concat from 'ramda/src/concat'
import dissoc from 'ramda/src/dissoc'
import flip from 'ramda/src/flip'
@mehiel
mehiel / FluxComponent.js
Last active August 29, 2018 17:45
Thinking on a FluxComponent
import { Component } from 'react'
import propOr from 'ramda/src/propOr'
import identity from 'ramda/src/identity'
import map from 'ramda/src/map'
import compose from 'ramda/src/compose'
class FluxComponent extends Component {
static createReducer = (initialState, handlers) => (state = {}, action) =>
propOr(identity, action.type, handlers)(state, action)
@mehiel
mehiel / CountriesDropdown.js
Last active October 20, 2020 12:02
React: use-dropdown hook
import React, { useRef } from "react";
import useDropdown from "use-dropdown";
function CountriesDropdown(props) {
const coutriesEl = useRef(null);
const countriesDropEl = useRef(null);
const [countriesDropOpen, toggleCountriesDrop] = useDropdown(countriesDropEl, coutriesEl);
const onClick = () => toggleCountriesDrop();
return (
@mehiel
mehiel / GIT_ALL_README.md
Last active June 25, 2021 07:52
Execute git command on all direct git subdirectories of the current directory using `git all`

If you put the git-all command provided in this gist as an executable in your PATH then:

For a structure like:

/just/a/project/group/path

  • project-1/
  • project-2/
  • project-3/

Where project-{1,2,3} are all git directories we can execute the following:

@mehiel
mehiel / autoarchive-tables.sh
Created May 30, 2020 15:45 — forked from borama/autoarchive-tables.sh
Shell script to automate MySQL tables time-based archival
#!/bin/bash
set -e
database="MY_DATABASE"
altered_tables=0
function fatal {
echo "FATAL: $1" >&2
echo "Exiting now." >&2
@mehiel
mehiel / run_ghost.sh
Created May 30, 2020 15:46 — forked from borama/run_ghost.sh
Helper shell script for running the gh-ost tool
#!/bin/bash
function usage {
echo "Use ./run_ghost.sh table_name 'alter_command' [other_ghost_args]"
exit 1
}
database="MY_DATABASE_NAME"
table=$1
@mehiel
mehiel / export-partition.sh
Created May 30, 2020 15:46 — forked from borama/export-partition.sh
Shell script to export data from the given table partition and delete it aferwards
#!/bin/bash
# "panic button" when run in a for loop:
# exit
database="MY_DATABASE"
export_dir="/mnt/backups/my-archive"
set -e