Skip to content

Instantly share code, notes, and snippets.

View drahamim's full-sized avatar

Daniel Rahamim drahamim

View GitHub Profile
@obscurerichard
obscurerichard / pull-request-poetry.md
Last active February 20, 2026 21:48
pull-request-poetry.md

Pull request poetry

by Richard Bullington-McGuire richard@obscure.org @obscurerichard on GitHub and Bluesky

Use these as comments in pull requests in order to charm the project owner into taking action on the pull request.

Initial ticklers

lonely pull request
the completist in me pines
for its prompt closure
@markddavidoff
markddavidoff / slack-pagerduty-oncall.py
Last active April 16, 2025 20:47
Updates a Slack User Group with People that are on call in PagerDuty (updated for pagerduty v2 api and pull from env vars instead of KMS). Based on:https://gist.github.com/devdazed/473ab227c323fb01838f
"""
Lambda Func to update slack usergroup based on pagerduty rotation
From: https://gist.github.com/devdazed/473ab227c323fb01838f
NOTE: If you get a permission denied while setting the usergroup it is because there’s a workspace preference in slack
that limits who can manage user groups. At the time of writing it was restricted to owners and admins so i had to get
an owner to install the app. First i added them as a collaborator and then had them re-install the app, and got the new
auth token and added that to param store.
@arnauldvm
arnauldvm / .gitconfig
Last active March 25, 2025 12:02
Git sync all local tracking branches with remotes
[alias]
tracking = "!f() { git for-each-ref --format '%(refname:short):%(upstream:short)' 'refs/heads' | egrep -v ':$'; }; f"
is-clean-workdir = "!f() { git diff --stat --exit-code || { echo \"Workdir dirty\"; exit 1; }; }; f"
is-clean-index = "!f() { git diff --stat --cached --exit-code || { echo \"Index dirty\"; exit 2; }; }; f"
is-clean = "!f() { git is-clean-workdir && git is-clean-index; }; f"
co-merge = "!f() { local=\"$1\"; remote=\"$2\"; git checkout \"$local\"; git merge --ff-only \"$remote\"; }; f"
current-branch = rev-parse --abbrev-ref HEAD
sync = "!f() { git is-clean || { echo Aborting sync.; exit 1; }; current=$(git current-branch); git fetch --all; git tracking | while IFS=: read local remote; do echo \"Merging $local with $remote\"; git co-merge \"$local\" \"$remote\"; done 3>&1 1>&2 2>&3 | egrep -i --color 'fatal|$' 3>&1 1>&2 2>&3; git checkout \"$current\"; }; f"
@amarao
amarao / blame-praise.py
Last active September 28, 2025 15:59
Example of argparse with subparsers for python
#!/usr/bin/env python
import argparse
def main(command_line=None):
parser = argparse.ArgumentParser('Blame Praise app')
parser.add_argument(
'--debug',
action='store_true',
help='Print debug info'
data_bag(:users).each do |user|
user_item = data_bag_item('users', user)
user user_item['id'] do
uid user_item['uid']
home user_item['home']
manage_home true
end
end
@spuder
spuder / chef-http-client.rb
Created April 1, 2016 20:43
A working, but ugly way to fetch from a url
ruby_block 'get build' do
block do
require "net/https"
require "uri"
require "json"
uri = URI.parse("http://nexus.example.com/nexus/service/local/repositories/foobar/content/master-5678.zip?describe=info")
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Get.new(uri.request_uri)
{
"elasticsearch" : {
"version": "value",
"hash": {
"key1": "value1",
"key2": "value2"
},
"key 3": "value3"
}
}
@devdazed
devdazed / slack-pagerduty-oncall.py
Last active February 11, 2026 20:43
Updates a Slack User Group with People that are on call in PagerDuty
#!/usr/bin/env python
from __future__ import print_function
import json
import logging
from urllib2 import Request, urlopen, URLError, HTTPError
from base64 import b64decode
@vinyar
vinyar / Bootstrapping chef client behind firewall
Created June 25, 2015 18:24
Bootstrapping chef client behind firewall
https://docs.chef.io/knife_bootstrap.html#custom-templates
https://docs.chef.io/install_bootstrap.html
https://docs.chef.io/knife_bootstrap.html
https://github.com/chef/chef/blob/12.2.1/lib/chef/knife/bootstrap/templates/chef-full.erb
https://github.com/chef/chef/blob/11.6.2/lib/chef/knife/bootstrap/chef-full.erb
Blog:
https://www.chef.io/blog/2014/10/28/working-with-chef-behind-your-firewall/
http://www.appneta.com/blog/customizing-chef-bootstrap-templates/
http://www.tomduffield.com/bootstrapping-without-the-internet/
@zytron
zytron / GitWorkflow
Last active August 29, 2015 14:13
Git workflow
# Create a new branch that forks off remote master
$ git checkout -b mybranch origin/master
# Make changes and commit to branch (you can use -m on command line to specify commit message, or leave it off and use your default editor to write your commit message when it prompts)
$ touch a.txt
$ git add a.txt
$ git commit -m "Added file"
$ vi a.txt
$ git add a.txt
$ git commit -m "Updated file"