Skip to content

Instantly share code, notes, and snippets.

@iocanel
iocanel / video-notes.org
Last active March 25, 2024 00:12
Taking notes from videos using Emacs

Video Notes

Introduction

This document describes my setup for taking notes from videos, using Emacs and org-mode.

My goals:

  • Embed & playback video links into my notes
  • Generate, embed & post process animated from my notes
@iocanel
iocanel / nutrition.org
Last active February 12, 2024 03:05
Nutrition tracking with Emacs and Org Mode

Nutrition tracking using Emacs

This is not a blog post. This is my Emacs powered nutrition tracker!

No, I mean it!

It’s the one file that contains all the code, templates and data of my tracker,

@iocanel
iocanel / get-host.ip.sh
Created August 31, 2015 13:20
Get the docker host ip inside Kubernetes
#!/bin/bash
KUBERNETES=https://$KUBERNETES_SERVICE_HOST:$KUBERNETES_SERVICE_PORT
TOKEN=`cat /var/run/secrets/kubernetes.io/serviceaccount/token`
POD=`hostname`
curl -s -k -H "Authorization: Bearer $TOKEN" $KUBERNETES/api/v1/namespaces/$KUBERNETES_NAMESPACE/pods/$POD | grep -i hostIp | cut -d "\"" -f 4
@iocanel
iocanel / jenkins-keygen.sh
Created September 1, 2015 09:05
Jenkins key generation
#Generate master.key and secret
MAGIC="::::MAGIC::::"
mkdir -p /var/jenkins_home/secrets
openssl rand -hex 128 > /var/jenkins_home/secrets/master.key
openssl dgst -sha256 -binary /var/jenkins_home/secrets/master.key > /tmp/master.hashed
HEX_MASTER_KEY=`head -c 16 /tmp/master.hashed | xxd -l 16 -p`
openssl rand 259 > /tmp/base
echo $MAGIC >> /tmp/base
openssl enc -aes-128-ecb -in /tmp/base -K $HEX_MASTER_KEY -out /var/jenkins_home/secrets/hudson.util.Secret
@iocanel
iocanel / pre-commit
Created May 12, 2022 07:04
Git pre-commit hook to prevent pdf and adoc changes in the same commit
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-commit".
if git rev-parse --verify HEAD >/dev/null 2>&1
@iocanel
iocanel / get-current-user.lisp
Created October 18, 2021 19:45
Get the current user from the github buffer
(defun github-current-user ()
"Get the curently logged in user."
(let ((page-source (if (web-buffer-p (current-buffer))
(plump:serialize (document-model (current-buffer)) nil)
(ffi-buffer-get-document (current-buffer)))))
(ppcre:register-groups-bind (user) (".*<meta name=\"user-login\" content=\"([a-zA-Z0-9_-]+)\">.*" page-source) user)))
@iocanel
iocanel / jenkins-setup-credentials.groovy
Created September 1, 2015 09:12
Setup Jenkins Credentials
import jenkins.model.*
import com.cloudbees.plugins.credentials.*
import com.cloudbees.plugins.credentials.common.*
import com.cloudbees.plugins.credentials.domains.*
import com.cloudbees.plugins.credentials.impl.*
import com.cloudbees.jenkins.plugins.sshcredentials.impl.*
import hudson.plugins.sshslaves.*;
domain = Domain.global()
store = Jenkins.instance.getExtensionList('com.cloudbees.plugins.credentials.SystemCredentialsProvider')[0].getStore()
@iocanel
iocanel / gist:1979256
Created March 5, 2012 16:56
Filtering empty lists from a camel route
<filter>
<simple>${body.size} != 0</simple>
<to uri="my:final-destination"/>
</filter>
@iocanel
iocanel / jenkin-encrpyt.sh
Last active October 2, 2020 19:14
Jenkins Encrypt Script
#!/bin/bash
IN=`echo $1 | base64`
SUFFIX="::::MAGIC::::"
MASTER_KEY=`cat /var/jenkins_home/secrets/master.key`
HASHED_MASTER_KEY=`echo -n $MASTER_KEY | sha256sum | cut -d " " -f 1`
HASHED_MASTER_KEY_16=${HASHED_MASTER_KEY:0:16}
openssl enc -d -aes-128-ecb -in /var/jenkins_home/secrets/hudson.util.Secret -K $HASHED_MASTER_KEY -out /tmp/hudson.key
HUDSON_KEY=`cat /tmp/hudson.key`
HUDSON_KEY_TRIMMED=${HUDSON_KEY:0:-16}
HUDSON_KEY_16=${HUDSON_KEY_TRIMMED:0:16}
@iocanel
iocanel / jenkins-run-pipeline.sh
Created August 25, 2017 12:26
Run Jenkins pipeline from shell
#!/bin/bash
JOB="dev"
CONFIG_XML="/tmp/jenkins-job.xml"
PIPELINE=`cat $1`
read -r -d '' HEADER << __HEADER__
<?xml version="1.0" encoding="UTF-8"?><flow-definition plugin="workflow-job@2.3">
<actions/>
<description/>