Skip to content

Instantly share code, notes, and snippets.

@kenglxn
kenglxn / list_fb_jira_status.fish
Created October 8, 2018 08:26
list_fb_jira_status
function list_fb_jira_status
set issues (ls ~/dev/git/sirius | grep utv-feature-sh- | grep -e '[a-zA-Z]\\+-[0-9]\\+' -o)
read -l -P 'jira username? ' username
read -l -i -P 'jira password? ' password
for issue in $issues
set -x json (curl -s -u $username:$password -X GET -H "Content-Type: application/json" "https://jira.sits.no/rest/api/2/issue/$issue?fields=status")
set issue_status (python -c 'import os,json;obj=json.loads(os.environ["json"]);status=obj["fields"]["status"]["name"];print status.encode("utf-8");')
echo $issue "(https://jira.sits.no/browse/$issue)" status: $issue_status
@kenglxn
kenglxn / aoc_search.js
Last active October 18, 2018 08:28
bookmarklet for søk i aurora console
javascript:(function () {
document
.querySelector('.user-profile p')
.appendChild(document.createElement('input'))
.addEventListener('keyup', (ev) => {
if (ev.target.value.length === 0) {
document.querySelectorAll('.console-table th, .console-table td').forEach(elem => (elem.style.display = ''));
}
if (ev.target.value.length > 2) {
const indexes = Array.from(document.querySelectorAll('.console-table thead th').entries()).filter(([idx, elem]) => elem.innerText.includes(ev.target.value)).map(([idx, elem]) => idx);
@kenglxn
kenglxn / AOC_Sticky.js
Last active May 28, 2018 06:01
bookmarklet for hacking aoc layout
javascript:(function () { document.querySelectorAll('.console-table tr th:first-child,.console-table tr td:first-child').forEach(e => e.style = 'position: sticky; left: 0; min-width: 200px; background-color:white;');}())
@kenglxn
kenglxn / rm_f_branch.fish
Created April 12, 2018 08:20
ao feature branch util function
function rm_f_branch
if test (count $argv) -eq 2
set jira $argv[1]
set prefix $argv[2]
set env_name (echo utv-$prefix-$jira | tr '[:upper:]' '[:lower:]')
pushd ~/dev/git/sirius
echo "Deleting feature branch for $env_name"
@kenglxn
kenglxn / mk_f_branch.fish
Last active May 28, 2018 06:00
ao feature branch util function
function mk_f_branch
if test (count $argv) -eq 2
set jira $argv[1]
set prefix $argv[2]
set env_name (echo utv-$prefix-$jira | tr '[:upper:]' '[:lower:]')
pushd ~/dev/git/sirius
echo "Creating new feature branch for $env_name"
@kenglxn
kenglxn / diff_stat_master.fish
Created March 16, 2018 13:28
fish function for showing the number of commits origin/master is ahead, if any
function diff_stat_master
git remote update > /dev/null
set __master_commits (git rev-list HEAD..origin/master --count)
if test $__master_commits -gt 0
echo ""
echo "- There are $__master_commits new commits on origin/master -"
echo ""
end
end
@kenglxn
kenglxn / ocp.fish
Last active May 4, 2018 08:58
fish wrapper for simplyfying oc usage against pods
function ocp
if test (count $argv) -gt 1
set podname $argv[1]
set oc_cmd $argv[2]
set pods (oc get pods | grep -i running | grep $podname | awk '{print $1}')
if test (count $pods) -eq 0
echo "=> Found no pods using filter: $podname"
oc project
oc get pods
{
operator: function(elevators) {
//console.log("create operator", elevators);
var distance = function (floor, elevatorFloor) {
return Math.abs(floor - elevatorFloor);
};
var isClosest = function (fromFloor) {
return function (e) {
return distance(fromFloor, e.currentFloor());
};
[elasticsearch-2.x]
name=Elasticsearch repository for 2.x packages
baseurl=http://packages.elastic.co/elasticsearch/2.x/centos
gpgcheck=1
gpgkey=http://packages.elastic.co/GPG-KEY-elasticsearch
enabled=1
@kenglxn
kenglxn / jhome.fish
Last active May 10, 2022 13:30
If you have more javas and you want to switch between the javas, you can select a java from the javas with this...
function jhome
set -x JAVA_HOME (/usr/libexec/java_home $argv)
echo "JAVA_HOME:" $JAVA_HOME
echo "java -version:"
java -version
end