Skip to content

Instantly share code, notes, and snippets.

View jamjon3's full-sized avatar

James Jones jamjon3

  • YMD Partners
  • St Petersburg, Florida
View GitHub Profile
@magickatt
magickatt / github_clone_using_token.sh
Created September 6, 2019 17:31
Clone a GitHub repository using a Personal Access Token
export GITHUB_USER=magickatt
export GITHUB_TOKEN=secret
export GITHUB_REPOSITORY=magickatt/ContainerisingLegacyApplicationsTalk
git clone https://${GITHUB_USER}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}
@movd
movd / emails_from_ubuntu.md
Created June 6, 2019 11:02
Set up msmtp to send emails emails from Ubuntu/Debian Servers

Setting up email with SMTP on Ubuntu/Debian Servers

I used to sift trough my shell history and bookmarks every time I set up a new testing server in order to be able to send mails. So this should help...

Be aware don't use ssmtp anymore. It's unmaintained and has been removed from Debian and Ubuntu will most definitely follow suit.

Install msmtp

@maauso
maauso / haproxy.cfg.ctmpl
Created December 26, 2016 11:06
HaProxy with consul-template
global
daemon
{{range $index, $element := service (env "CONSUL_SYSLOG_NAME") }}
{{if eq $index 0}}log {{.Address}}:{{.Port}} local0{{ end }}
{{else}}
log {{env "LOCAL_SYSLOG"}} local0
{{ end }}
spread-checks {{env "HAPROXY_SPREAD_CHECKS"}}
max-spread-checks {{env "HAPROXY_MAX_SPREAD_CHECKS"}}
maxconn {{env "HAPROXY_MAXCONN_GLOBAL"}}
@lukechilds
lukechilds / get_latest_release.sh
Created August 9, 2016 19:43
Shell - Get latest release from GitHub
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}
# Usage
# $ get_latest_release "creationix/nvm"
# v0.31.4
@cgmartin
cgmartin / check-certs.sh
Created January 17, 2016 18:00
Bash SSL Certificate Expiration Check
#!/bin/bash
TARGET="mysite.example.net";
RECIPIENT="hostmaster@mysite.example.net";
DAYS=7;
echo "checking if $TARGET expires in less than $DAYS days";
expirationdate=$(date -d "$(: | openssl s_client -connect $TARGET:443 -servername $TARGET 2>/dev/null \
| openssl x509 -text \
| grep 'Not After' \
|awk '{print $4,$5,$7}')" '+%s');
in7days=$(($(date +%s) + (86400*$DAYS)));
@emilio2hd
emilio2hd / gradle_defaults_main.yml
Last active January 3, 2023 10:48
Ansible role to install sdkman and gradle
---
sdkman_script_install_url: http://get.sdkman.io
sdkman_folder: '/home/vagrant/.sdkman'
gradle_version: 2.3
@briantjacobs
briantjacobs / config.yml
Created November 24, 2015 19:43
Parse YAML from bash with sed and awk.
development:
adapter: mysql2
encoding: utf8
database: my_database
username: root
password:
apt:
- somepackage
- anotherpackage
@kdabir
kdabir / iso_date.groovy
Last active January 20, 2023 19:15
current date in iso 8601 in groovy
new Date().format("yyyy-MM-dd'T'HH:mm:ss'Z'", TimeZone.getTimeZone("UTC"))
@maxim
maxim / task.yml
Created June 12, 2014 11:09
Adding github to known_hosts with ansible
- name: ensure github.com is a known host
lineinfile:
dest: /root/.ssh/known_hosts
create: yes
state: present
line: "{{ lookup('pipe', 'ssh-keyscan -t rsa github.com') }}"
regexp: "^github\\.com"
@kristopherjohnson
kristopherjohnson / angular_karma.conf.js
Last active August 29, 2015 14:02
Set up yeoman and grunt to generate an AngularJS project and run it on OS X using Homebrew
// NOTE: Due to bugs in the Angular/Karma generators, the Karma runner may not work correctly when following the
// steps given in yeoman_angular.sh. If that's the case, compare the contents of your test/karma.conf.js with
// this version, and edit yours as needed.
// Karma configuration
// http://karma-runner.github.io/0.12/config/configuration-file.html
// Generated on 2014-06-05 using
// generator-karma 0.8.1
module.exports = function(config) {