Skip to content

Instantly share code, notes, and snippets.

@benwaffle
benwaffle / post-receive
Created September 16, 2023 06:47
ssh post-receive git hook for bare repo on server
#!/bin/bash
while read oldrev newrev ref
do
if [[ $ref =~ .*/master$ ]];
then
echo "Master ref received. Deploying master branch to production..."
git --work-tree=/home/deploy/server --git-dir=/home/deploy/server-bare checkout -f
else
echo "Ref $ref successfully received. Doing nothing: only the master branch may be deployed on this server."
fi
package util
import io.opentracing.util.GlobalTracer
import datadog.trace.api.DDTags
object Tracing {
private val tracer = GlobalTracer.get
private val serviceName = sys.env.getOrElse("DD_SERVICE", "missing DD_SERVICE env var")
#!/usr/bin/env vala --pkg gio-2.0
delegate void Func();
struct Box {
Func f;
}
async void run (Func f) {
var dummy = new Object ();
❯ eksctl get nodegroup --cluster ${CLUSTER_NAME} -v 4
2021-06-23 18:26:45 [▶] role ARN for the current session is "arn:aws:sts::<account-number>:assumed-role/DeveloperAdmin/me@me.com"
2021-06-23 18:26:45 [ℹ] eksctl version 0.54.0
2021-06-23 18:26:45 [ℹ] using region us-east-1
2021-06-23 18:26:45 [▶] cluster = {
Arn: "arn:aws:eks:us-east-1:<account-number>:cluster/CLUSTER_NAME",
CertificateAuthority: {
Data: "..."
},
CreatedAt: 2021-06-23 21:23:33.914 +0000 UTC,
#!/bin/bash
BG=(lightblue palegreen rosybrown1)
FG=(blue sienna purple)
i=0
jq -r '. | map(.text) | .[]' ./*.json | while read -r str; do
echo $i
convert -size 1280x720 -background "${BG[((i % ${#BG[@]}))]}" -fill "${FG[((i % ${#FG[@]}))]}" -gravity Center -pointsize 52 "caption:$str" "$i.png"
/\[block\:api-header\]/,/\[\/block\]/{
/\[\/?block/d
/[{}]/d
s/\s*"title": "(.+)"/\n# \1/
}
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project name="lineageos4microg/android_prebuilts_prebuiltapks" path="prebuilts/prebuiltapks" revision="master" />
<project name="PeterCxy/android_device_oneplus_guacamole" path="device/oneplus/guacamole" depth="1" />
<project name="PeterCxy/android_device_oneplus_sm8150-common" path="device/oneplus/sm8150-common" depth="1" />
<project name="PeterCxy/android_kernel_oneplus_sm8150" path="kernel/oneplus/sm8150" />
<project name="luk1337/proprietary_vendor_oneplus" path="vendor/oneplus" depth="1" />
<project name="LineageOS/android_device_oneplus_common" path="device/oneplus/common" />
<project name="LineageOS/android_packages_resources_devicesettings" path="packages/resources/devicesettings" />
</manifest>
#!/bin/bash
while read oldrev newrev ref
do
if [[ $ref =~ .*/master$ ]];
then
echo "Master ref received. Deploying master branch to production..."
git --work-tree=/home/deploy/server --git-dir=/home/deploy/server-bare checkout -f
else
echo "Ref $ref successfully received. Doing nothing: only the master branch may be deployed on this server."
fi
class Hey : Object, Json.Serializable {
public bool? required;
private ParamSpec req = new ParamSpecVariant ("required", "required", "required", new VariantType ("mb"), null, ParamFlags.READWRITE);
public override void set_property (ParamSpec pspec, Value value) {
if (pspec.get_name () == "required") {
Variant v = (Variant) value;
if (v.get_maybe () != null)
required = v.get_maybe ().get_boolean ();
@benwaffle
benwaffle / imdb-trakt.go
Last active September 29, 2019 01:57
Import watchlist from IMDb to Trakt.tv
package main
import (
"bytes"
"encoding/csv"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"