Skip to content

Instantly share code, notes, and snippets.

View benpdavison's full-sized avatar

Ben Davison benpdavison

View GitHub Profile
@benpdavison
benpdavison / clone-all-github-repos.sh
Created November 15, 2018 11:16
Clone All Repos from GitHub Organisation including Private Repos
# For this to work you will need a Personal Access Token for your account
# I allowed all the permission for the personal access token as I deleted it straight after use.
# If your organisation uses SSO, you need to allow it on the personal acces token.
# Replace PERSONAL_ACCESS_TOKEN with the personal access token that is generated.
# Replace YOU_GITHUB_ORG with your organisation name.
# Thanks goes to caniszczyk for the original script, available here: https://gist.github.com/caniszczyk/3856584
# There are non Ruby version available on the original discussion, however I found this to be most reliable.
curl -H "Authorization: token PERSONAL_ACCESS_TOKEN" https://api.github.com/orgs/YOU_GITHUB_ORG/repos?per_page=200 | ruby -rubygems -e 'require "json"; JSON.load(STDIN.read).each { |repo| %x[git clone #{repo["ssh_url"]} ]}'
kafka-delete-records --bootstrap-server localhost:9092 --offset-json-file ./offsetfile.json
// where offsetfile.json is:
{"partitions": [{ "topic": "event_source.quotes", "partition": 0, "offset": -1 }], "version":1 }
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
class EPOCToISO {
public static void main(String[ ] args) {
Long epoch = 1535109390070L;
Instant i = Instant.ofEpochMilli(epoch);
// This code should allow you to update the different fields in the appspec.yml for AWS Code Deploy.
// Updating the source file location is just an example. All paramaters can be edited.
// readYaml and writeYaml come from the pipline-utility-steps-plugin (https://github.com/jenkinsci/pipeline-utility-steps-plugin)
void updateAppspec(String newFile) {
// By default reads from the working directory
String appspecFile = "appspec.yml"
Map data = readYaml file: appspecFile
String destination = data.files[0].destination
// files is a ArrayList
data.files.set(0, ["source":newFile, "destination": "${destination}"])

Keybase proof

I hereby claim:

  • I am benpdavison on github.
  • I am cheifly (https://keybase.io/cheifly) on keybase.
  • I have a public key whose fingerprint is C8E0 D79D 7725 A8D1 1528 5C0B 8E0B 8472 CBC3 B7E4

To claim this, I am signing this object: