Skip to content

Instantly share code, notes, and snippets.

View chmouel's full-sized avatar
🤨
Kuberneting

Chmouel Boudjnah chmouel

🤨
Kuberneting
View GitHub Profile
;; Adapted from https://gist.github.com/ieure/883725 for magit-log
(eval-after-load "magit"
'(progn
(defun magit-log-browse-github-commit (commit)
"Open a browser pointing to the current commit on GitHub.
With prefix argument, go to the commit HEAD is at."
(interactive "p")
(let* ((branch (magit-get-current-branch))
(remote (and branch (magit-get "branch" branch "remote")))
@chmouel
chmouel / export-all-ose3-resources.bash
Last active February 25, 2016 07:43
Export all openshift 3 resources from all users and defaults, should be good for backups
#!/bin/bash
alltypes="pods,po,replicationcontrollers,rc,daemonsets,ds,services,svc,events,ev,secrets,persistentvolumes,pv,persistentvolumeclaims,pvc,limitranges,limits,resourcequotas,quota,nodes,no,namespaces,ns,componentstatuses,cs,endpoints,ep,serviceaccounts,sa,securitycontextconstraints,scc,deploymentconfigs,dc,buildconfigs,bc,builds,routes,projects,imagestreams,is,imagestreamtags,istag,policies,rolebindings,users,groups,templates,policybindings,roles,oauthclients"
oc export ${alltypes} --all-namespaces
#!/bin/bash
while getopts ":l" o; do
case "${o}" in
l)
FROMLAST=yes
;;
esac
done
shift $((OPTIND-1))
@chmouel
chmouel / sql-musing.go
Last active October 27, 2016 16:50
Some examples how to use sql with golang
// -*- mode:go;mode:go-playground -*-
// snippet of code @ 2016-04-26 19:49:37
//
// run snippet with Ctl-Return
package main
import (
"database/sql"
"fmt"
@chmouel
chmouel / comics-view-comic-download.sh
Created May 7, 2016 06:19
view-comic.com fetch and generate cbz
#!/bin/bash
set -e
set -x
ARG=$1
[[ -z ${ARG} ]] && exit 1
BASE=$(basename ${ARG})
tmpfile=/tmp/.$$.tmp.html
#!/bin/bash
# download episodes from readcomics.net take an episode and download it, to download full serie do things like :
# comics-read-comics-download.com http://www.readcomics.net/red-robin/chapter-{1..26}
# this uses bash/zsh nifty seq expansions it basically converts it to chapter-1 chapter-2 chapter-3 etc..
set -e
#set -x
function dwl() {
local ARG BASE tmpfile IMAGES dirimg bimg
@chmouel
chmouel / nginx-ssl-configuration.conf
Created September 19, 2016 05:54
nginx-ssl-proxy-pass-configuration
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name blog.chmouel.com;
ssl on;
ssl_certificate /etc/letsencrypt/live/blog.chmouel.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/blog.chmouel.com/privkey.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
#!/bin/bash
WEBURL=yamaha.local
VOLUMESTEP=50
function enrobe() {
local mode=$1
local blob=$2
[[ ${mode} == "PUT" ]] && shut="-o/dev/null"
@chmouel
chmouel / watch-stock.bash
Created September 26, 2016 13:16
Watch Stock and notify you when it reach a number or lower to a number. When notified it will create a file in /tmp/.reported.up/down.txt rm it or create a cron that delete the old bugger after certain day
#!/bin/bash
greater= # set to a price i.e: 20
lower= # set to a price i.e: 10
companystock= # set to a stock sympbol i.e: goog, aapl, fb (will only do for one)
[email protected]
function report() {
local mode=$1
local target=$2
local price=$3
[Unit]
Description=Job that runs the python SimpleHTTPServer daemon
[Service]
Type=idle
WorkingDirectory=/media/bigdisk
ExecStart=/usr/bin/python -m SimpleHTTPServer 8888
TimeoutStopSec=1
Restart=always
RestartSec=2