Skip to content

Instantly share code, notes, and snippets.

@benkehoe
benkehoe / py-args-for-bash.sh
Last active August 3, 2023 08:58
Python argument parsing for bash scripts
#!/bin/sh
# MIT No Attribution
#
# Copyright 2020 Ben Kehoe
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this
# software and associated documentation files (the "Software"), to deal in the Software
# without restriction, including without limitation the rights to use, copy, modify,
# merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
@RulerOf
RulerOf / zfs-on-oracle-linux-7.md
Last active June 7, 2019 19:46
Installing ZFS on Linux on Oracle Linux 7

Installing ZFS on Linux on Oracle Linux 7

We're going to add ZFS support to our Oracle Linux installation. We'll just add the ZFS on Linux Repo, verify the binary signature from GitHub, install the files, ensure the driver loads properly, and verify that it's functional. We'll save things like array creation for another document.

This is mostly a transcription of the process from the CentOS/RHEL ZoL installation manual.

Note

This will install ZFS v0.7 release on OEL 7.7 and earlier, and ZFS 0.8 on OEL 7.8 and later.

Install the repo file

@belminf
belminf / aws-cli.sh
Last active August 6, 2021 23:27
AWS CLI command to find latest RHEL and Ubuntu images using JMESPath
# Both are limited to HVM-based 64-bit AMIs backed by EBS
# Red Hat's latest GA images
alias ami_rhel="aws ec2 describe-images \
--filters \
'Name=root-device-type,Values=ebs' \
'Name=architecture,Values=x86_64' \
'Name=virtualization-type,Values=hvm' \
'Name=name,Values=*GA*' \
--owners 309956199498 \
@xjamundx
xjamundx / blog-webpack-2.md
Last active April 21, 2024 16:20
From Require.js to Webpack - Part 2 (the how)

This is the follow up to a post I wrote recently called From Require.js to Webpack - Party 1 (the why) which was published in my personal blog.

In that post I talked about 3 main reasons for moving from require.js to webpack:

  1. Common JS support
  2. NPM support
  3. a healthy loader/plugin ecosystem.

Here I'll instead talk about some of the technical challenges that we faced during the migration. Despite the clear benefits in developer experience (DX) the setup was fairly difficult and I'd like to cover some of the challanges we faced to make the transition a bit easier.

@jaytaylor
jaytaylor / etc-init-gitbucket.conf
Created March 16, 2015 17:48
Gitbucket (for JAR releases from: https://github.com/takezoe/gitbucket, located in /home/ubuntu/gitbucket/gitbucker.war).
#!upstart
description "gitbucket"
env USER=ubuntu
env PID=/var/run/gitbucket.pid
env STDOUT=/var/log/gitbucket/gitbucket.log
env STDERR=/var/log/gitbucket/gitbucket.err
start on (local-filesystems and net-device-up IFACE!=lo)
stop on [!12345]
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@jaytaylor
jaytaylor / WIP--auto-unrar-updated-for-2020.sh
Last active March 18, 2020 18:06
Busy-box compatible automatic RAR extraction system.
#!/usr/bin/env bash
##
#
# @author Jay Taylor [@jtaylor]
#
# @date
#
# @description Busy-box compatible automatic RAR extraction system.
#
@elwinar
elwinar / snake.go
Created November 18, 2014 11:30
ToSnake function for golang, convention-compliant
package main
import (
"unicode"
)
// ToSnake convert the given string to snake case following the Golang format:
// acronyms are converted to lower-case and preceded by an underscore.
func ToSnake(in string) string {
runes := []rune(in)
@jaytaylor
jaytaylor / dataloop_post_install.sh
Last active August 29, 2015 14:04
DataLoop ubuntu post-install cleanup script.
#!/usr/bin/env bash
set -e -x
# Shutdown the dataloop agent.
sudo service dataloop-agent stop || true
# Kill stragglers in the even that the service control didn't work right.
agentPids=$(ps -ef | grep 'dataloop-lin-agent' | grep -v 'grep' | sed 's/ \+/ /g' | cut -d' ' -f2)
test -n "${agentPids}" && sudo kill -9 ${agentPids}
@DavidVaini
DavidVaini / round.go
Created April 9, 2014 19:58
Arggh Golang does not include a round function in the standard math package. So I wrote a quick one.
package main
import (
"log"
"math"
)
func Round(val float64, roundOn float64, places int ) (newVal float64) {
var round float64
pow := math.Pow(10, float64(places))