Skip to content

Instantly share code, notes, and snippets.

View amacneil's full-sized avatar
💜
Foxglove Studio

Adrian Macneil amacneil

💜
Foxglove Studio
View GitHub Profile
import rosbag
import rospy
from time import time
from geometry_msgs.msg import Pose, Transform, TransformStamped
from visualization_msgs.msg import Marker, MarkerArray
from pprint import pprint
now = round(time())
bag = rosbag.Bag('bug.bag', 'w')
@amacneil
amacneil / dependabot-fix.yml
Created March 19, 2021 03:29
GitHub Action to update yarn 2 `yarn.lock` on dependabot PRs
# Automatically save updated `yarn.lock` file for dependabot PRs.
# This is necessary because dependabot doesn't support Yarn v2 yet:
# https://github.com/dependabot/dependabot-core/issues/1297
#
# Note: We use the `pull_request_target` event due to GitHub security measures.
# It is important to ensure we don't execute any untrusted PR code in this context.
# See: https://github.blog/changelog/2021-02-19-github-actions-workflows-triggered-by-dependabot-prs-will-run-with-read-only-permissions/
# https://securitylab.github.com/research/github-actions-preventing-pwn-requests
name: Dependabot
@amacneil
amacneil / Dockerfile
Created September 4, 2020 23:30
Unprivileged user in docker
FROM ubuntu
# install apt packages
RUN apt-get update \
&& apt-get install -qq --no-install-recommends \
gosu \
man \
sudo \
&& rm -rf /var/lib/apt/lists/*
#!/bin/bash
# if we are testing a PR, merge it with the latest master branch before testing
# this ensures that all tests pass with the latest changes in master.
set -eu -o pipefail
PR_NUMBER=${CI_PULL_REQUEST//*pull\//}
err=0
if [ -z "$PR_NUMBER" ]; then
@amacneil
amacneil / git-pre-receive-log.sh
Created June 13, 2016 00:28
Pre-receive hook to limit maximum git file size (attempt 2 - checks all objects but is slow)
#!/bin/bash -e
nullsha="0000000000000000000000000000000000000000"
maxsize=5
maxbytes=$(( $maxsize * 1024 * 1024 ))
status=0
# Read stdin for ref information
while read oldref newref refname; do
echo ref: $oldref $newref $refname
@amacneil
amacneil / git-pre-receive-diff.sh
Created June 13, 2016 00:27
Pre-receive hook to limit maximum git file size (attempt 1 - only compares diff)
#!/bin/bash -e
GITCMD="git"
NULLSHA="0000000000000000000000000000000000000000"
MAXSIZE="10"
MAXBYTES=$(( $MAXSIZE * 1024 * 1024 ))
EXIT=0
# Read stdin for ref information
while read oldref newref refname; do
FROM python:3.4.2
ENV PYTHONUNBUFFERED 1
# Create app directory
RUN mkdir /app
WORKDIR /app
# Install requirements
COPY requirements.txt /app/
RUN pip install --upgrade pip \
import Koa from 'koa';
import Router from 'koa-router';
const koa = new Koa();
const app = new Router();
app.get('/:name', async (ctx) => {
ctx.body = `Hello, ${ctx.params.name}!\n`;
});
{
"plugins": [
"transform-async-to-generator",
"transform-es2015-modules-commonjs"
]
}
async function foo() {
const userId = 42;
const user = await User.findById(userId);
return user.name;
}
function foo() {
const userId = 42;