Skip to content

Instantly share code, notes, and snippets.

View spenserpothier's full-sized avatar
🍔

Spenser Pothier spenserpothier

🍔
View GitHub Profile
@wbsch
wbsch / on-modify.timetrack.py
Last active November 10, 2021 21:17
Time tracking hook script for Taskwarrior that outputs ledger timelog formatted data.
#!/usr/bin/env python
#
# Writes task start/stop times to a timelog formatted file.
# You might need to adjust LEDGERFILE, or set the TIMELOG environment variable.
#
# Example reports, after using start/stop on a task:
# ledger -f /path/to/timelog.ledger print
# ledger -f /path/to/timelog.ledger register
#
# Projects, tags, and UUIDs are fully supported and queryable from ledger.
@ecampidoglio
ecampidoglio / commit-msg.sh
Last active August 22, 2019 20:33
A client-side Git hook that checks the length of the commit message.
#!/bin/sh
#
# A hook script that checks the length of the commit message.
#
# Called by "git commit" with one argument, the name of the file
# that has the commit message. The hook should exit with non-zero
# status after issuing an appropriate message if it wants to stop the
# commit. The hook is allowed to edit the commit message file.
DEFAULT="\033[0m"
@stuart-warren
stuart-warren / CreateJob.sh
Last active March 8, 2024 16:20
Create a job in Jenkins (or folder) using the HTTP API
# check if job exists
curl -XGET 'http://jenkins/checkJobName?value=yourJobFolderName' --user user.name:YourAPIToken
# with folder plugin
curl -s -XPOST 'http://jenkins/job/FolderName/createItem?name=yourJobName' --data-binary @config.xml -H "Content-Type:text/xml" --user user.name:YourAPIToken
# without folder plugin
curl -s -XPOST 'http://jenkins/createItem?name=yourJobName' --data-binary @config.xml -H "Content-Type:text/xml" --user user.name:YourAPIToken
# create folder
@MattSurabian
MattSurabian / PackerPolicy.json
Last active May 27, 2022 21:46
Minimum IAM policy required by AWS for Packer to do its thing. https://github.com/mitchellh/packer Permissions are broken out by API functionality and a resource array has been defined with a wild card for each group. For tighter security resource level permissions can be applied per this documentation: http://aws.typepad.com/aws/2013/07/resourc…
{
"Statement": [
{
"Sid": "PackerSecurityGroupAccess",
"Action": [
"ec2:CreateSecurityGroup",
"ec2:DeleteSecurityGroup",
"ec2:DescribeSecurityGroups",
"ec2:AuthorizeSecurityGroupIngress",
"ec2:RevokeSecurityGroupIngress"
@75th
75th / rot.sh
Last active January 25, 2019 16:06
A Bash script for Caesar ciphers. I needed (well, wanted) a tool to do ROT-n ciphers for arbitrary n. So here it is. If n is not provided, it defaults to ROT-13. No ROT-5 for numerals as yet. This is my first shell script for public consumption; feedback is eagerly welcome, but please be gentle.
#! /bin/bash
# Usage: rot [base] string
#
# Base is assumed to be 13 if not specified.
#
# Bases not in 0-25 are taken modulo 26; negatives are increased by
# 26es until they're positive. Thus, any integer should work
# as expected.
@mislav
mislav / OpenSSL fix.md
Last active June 8, 2023 07:48
Fix OpenSSL certificate errors on Ruby 2.0

The reason why you might get certificate errors in Ruby 2.0 when talking HTTPS is because there isn't a default certificate bundle that OpenSSL (which was used when building Ruby) trusts.

Update: this problem is solved in edge versions of rbenv and RVM.

$ ruby -rnet/https -e "Net::HTTP.get URI('https://github.com')"
net/http.rb:917:in `connect': SSL_connect returned=1 errno=0 state=SSLv3
  read server certificate B: certificate verify failed (OpenSSL::SSL::SSLError)

You can work around the issue by installing a certificate bundle that you trust. I trust Mozilla and curl.

@ngoffee
ngoffee / nv2org.sh
Created November 1, 2012 01:11
Convert a directory of Notational Velocity notes to a single Emacs org-mode file
#!/bin/sh
# Convert a directory of Notational Velocity notes to a single file of
# Emacs org-mode notes. Must be run from within the directory to be
# converted. Each entry in the resulting org file will be a 2nd-level
# entry ("** ...") whose title is derived from the filename and whose
# body contains the file contents. Output is written to stdout. '*' at
# the beginning of a line will be converted to '-' to avoid being
# confused with an org-mode headline.
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 26, 2024 17:22
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@johnthethird
johnthethird / customdomain.rb
Created September 23, 2011 22:23 — forked from dwabnitz/customdomain.rb
rack middleware to resolve a custom domain to an original subdomain in a multi-tenant application
require 'net/dns/resolver'
# Custom Domain
#
# Require net-dns gem
#
# A Rack middleware to to resolve the custom domain to original subdomain
# for your multi telent application.
#
# It's all transperant to your application, it performs cname lookup and
@dwabnitz
dwabnitz / customdomain.rb
Created October 22, 2009 19:18 — forked from speedmax/customdomain.rb
rack middleware to resolve a custom domain to an original subdomain in a multi-tenant application
require 'net/dns/resolver'
# Custom Domain
#
# Require net-dns gem
#
# A Rack middleware to to resolve the custom domain to original subdomain
# for your multi telent application.
#
# It's all transperant to your application, it performs cname lookup and