Skip to content

Instantly share code, notes, and snippets.

@swinton
swinton / README.md
Last active March 25, 2024 03:56
Automatically sign your commits from GitHub Actions, using the REST API

Verified commits made easy with GitHub Actions

image

So you want to commit changes generated by a GitHub Actions workflow back to your repo, and have that commit signed automatically?

Here's one way this is possible, using the REST API, the auto-generated GITHUB_TOKEN, and the GitHub CLI, gh, which is pre-installed on GitHub's hosted Actions runners.

You don't have to configure the git client, just add a step like the one below... Be sure to edit FILE_TO_COMMIT and DESTINATION_BRANCH to suit your needs.

@swinton
swinton / proxy.pac
Created February 11, 2015 02:26
Example proxy.pac, using a SOCKS proxy for certain hosts.
function FindProxyForURL(url, host) {
var useSocks = ["imgur.com"];
for (var i= 0; i < useSocks.length; i++) {
if (shExpMatch(host, useSocks[i])) {
return "SOCKS localhost:9999";
}
}
return "DIRECT";
@swinton
swinton / README.md
Created December 3, 2020 22:24
Using GitHub's Git data API

Using GitHub's Git data API by Example

  1. Create a blob
  2. Create a tree
  3. Create a commit
  4. Create (or update) a ref

Create a blob

@swinton
swinton / upstart_virtualenv_test.conf
Created March 5, 2012 15:44
Example of an upstart job running a python script under a virtualenv
########################################
##### upstart_virtualenv_test.conf #####
##### install in /etc/init #####
########################################
description "Testing virtualenv and upstart setup"
env PYTHON_HOME=/home/steve/.virtualenvs/upstart-test
start on runlevel [2345]
@swinton
swinton / AESCipher.py
Last active April 30, 2023 05:48
Encrypt & Decrypt using PyCrypto AES 256 From http://stackoverflow.com/a/12525165/119849
#!/usr/bin/env python
import base64
from Crypto import Random
from Crypto.Cipher import AES
BS = 16
pad = lambda s: s + (BS - len(s) % BS) * chr(BS - len(s) % BS)
unpad = lambda s : s[0:-ord(s[-1])]
@swinton
swinton / self-hosted-runners-playground.md
Created February 25, 2020 17:08
Programmatically create a self-hosted runner
@swinton
swinton / IssueTimelineItemsConnection.graphql
Created November 13, 2020 14:05
GraphQL | IssueTimelineItemsConnection usage
{
resource(url: "https://github.com/microsoft/vscode/issues/10121") {
... on Issue {
url
title
timelineItems(first: 50, itemTypes: [CROSS_REFERENCED_EVENT]) {
edges {
node {
... on CrossReferencedEvent {
source {
# eks.yml
on:
pull_request:
push:
branches: # array of glob patterns matching against refs/heads. Optional; defaults to all
- master # triggers on pushes that contain changes in master
name: Build and Deploy to EKS
env:

How to tell if Rosetta is installed?

lsbom -f /Library/Apple/System/Library/Receipts/com.apple.pkg.RosettaUpdateAuto.bom

Or

ls /usr/libexec/rosetta
/**
* POST data from a Google Spreadsheet to a remote URL, via menu option Add-ons > Post values
* See: http://www.google.com/google-d-s/scripts/guide.html for more info
*/
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheets()[0];
var r = sheet.getRange("B5");
function onOpen() {