Skip to content

Instantly share code, notes, and snippets.

View list_fb_jira_status.fish
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 Oct 18, 2018
bookmarklet for søk i aurora console
View aoc_search.js
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
bookmarklet for hacking aoc layout
View AOC_Sticky.js
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 Apr 12, 2018
ao feature branch util function
View rm_f_branch.fish
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
ao feature branch util function
View mk_f_branch.fish
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 Mar 16, 2018
fish function for showing the number of commits origin/master is ahead, if any
View diff_stat_master.fish
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
fish wrapper for simplyfying oc usage against pods
View ocp.fish
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
View elevator-saga-solution.js
{
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());
};
View elasticsearch.repo
[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 Oct 26, 2019
If you have more javas and you want to switch between the javas, you can select a java from the javas with this...
View jhome.fish
function jhome
set -x JAVA_HOME (/usr/libexec/java_home $argv)
echo "JAVA_HOME:" $JAVA_HOME
echo "java -version:"
java -version
end
You can’t perform that action at this time.