This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some Jenkinsfile examples |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1.a- kubectl run | |
kubectl get pods | |
kubectl run first-deployment --image=nginx | |
kubectl get pods | |
(maybe one more time to show the state changed from container creation to Running) | |
(copy the pod name from get pods) | |
kubectl exec -it pod-name -- /bin/bash | |
echo Hello nginx! > /usr/share/nginx/html/index.html | |
apt-get update |
Use a git hook to match a Jira issue ID from the current branch, and prepend it to every commit message
Assuming the current branch contains a Jira issue ID, you can use a git hook script to prepend it to every commit message.
-
Create an empty commit-msg git hook file, and make it executable. From your project's root directory:
install -b -m 755 /dev/null .git/hooks/commit-msg
-
Save the following script to the newly-created .git/hooks/commit-msg file:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# move this file to /etc/init.d/monit | |
### BEGIN INIT INFO | |
# Provides: monit | |
# Required-Start: $remote_fs | |
# Required-Stop: $remote_fs | |
# Should-Start: $all | |
# Should-Stop: $all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" copy all this into a vim buffer, save it, then... | |
" source the file by typing :so % | |
" Now the vim buffer acts like a specialized application for mastering vim | |
" There are two queues, Study and Known. Depending how confident you feel | |
" about the item you are currently learning, you can move it down several | |
" positions, all the way to the end of the Study queue, or to the Known | |
" queue. | |
" type ,, (that's comma comma) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ( | |
"fmt" | |
"net/http" | |
"time" | |
) | |
const transPixel = "\x47\x49\x46\x38\x39\x61\x01\x00\x01\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x21\xF9\x04\x01\x00\x00\x00\x00\x2C\x00\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02\x44\x01\x00\x3B" | |
func pixelHandler(w http.ResponseWriter, r *http.Request) { | |
// Pixel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import plistlib | |
from shutil import copy | |
import subprocess | |
import os | |
from tempfile import gettempdir | |
import sys | |
import atexit | |
BOOKMARKS_PLIST = '~/Library/Safari/Bookmarks.plist' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
########################################################################## | |
# library | |
########################################################################## | |
# via http://stackoverflow.com/a/12199798/18706 | |
function format_date { | |
((h=${1}/3600)) | |
((m=(${1}%3600)/60)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/https' | |
require 'nokogiri' | |
url = "https://example.com" | |
url = URI.parse( url ) | |
http = Net::HTTP.new( url.host, url.port ) | |
http.use_ssl = true if url.port == 443 | |
http.verify_mode = OpenSSL::SSL::VERIFY_NONE if url.port == 443 | |
path = url.path | |
path += "?" + url.query unless url.query.nil? |
NewerOlder