Skip to content

Instantly share code, notes, and snippets.

View thcipriani's full-sized avatar

Tyler Cipriani thcipriani

View GitHub Profile
@Chubek
Chubek / witty.rb
Created February 25, 2024 09:41
Witty.rb -> Parse .git/index
#!/usr/bin/env ruby
# === Witty.rb ===
# A very simple Ruby Script
# Author: Chubak Bidpaa (github.com/Chubek)
#
# ** What does this do? **
# This script demonstrates how to parse a Git index file (.git/index)
# using nothing but the languages IO facilities. This is perhaps best
# done in a systems language, or a strongly-typed language where there

Cloning All Gerrit Repos

I'm doing this with the myrepos perl script. I started down the path of reimplementing a good chunk of functionality of myrepos before realizing my mistake and generating a config file instead :)

To generate the config file I used this beauty:

while read repo; do
    printf '[%s]\n%s\n\n' "${repo}.git" "checkout = git clone --mirror https://gerrit-replica.wikimedia.org/r/${repo}"

done < <(curl -sL https://gerrit.wikimedia.org/r/projects/?all | \

@montehurd
montehurd / matplotlib.sh
Last active August 4, 2022 21:26
Super easy method for experimenting with matplotlib graphs - with a bunch of examples. Approach used below is for purpose of quick prototyping (configure graphs, convert output to base64 encoded html tags, send html directly to browser). Script is easily modified and can run by pasting its text into a Terminal window. Tested on macOS.
#!/bin/bash
# Edit: this code is simply horrible in many ways, but that's how we learn I suppose.
# See the comment below for a better example:
# https://gist.github.com/montehurd/1f8ffb8de517adc1d54d6e6b62ad9f88?permalink_comment_id=3742328#gistcomment-3742328
read -r -d '' PYTHON_SCRIPT << --END
@gertvdijk
gertvdijk / init_and_start_gerrit.sh
Created July 27, 2018 11:13
Init and start Gerrit in a single shell script example
#!/bin/sh -ex
SITE_PATH="${HOME}/site"
GERRIT_WAR="/path/to/gerrit.war"
# Because Gerrit's "daemon --init" can't take init options we will do this
# separately. Feature request filed:
# https://bugs.chromium.org/p/gerrit/issues/detail?id=9004
# Init site (provision). Note that the GERRIT_WAR may be a different version
@prasanthj
prasanthj / lirc-pi3.txt
Last active January 5, 2023 01:35
Getting lirc to work with Raspberry Pi 3 (Raspbian Stretch)
Notes to make IR shield (made by LinkSprite) work in Raspberry Pi 3 (bought from Amazon [1]).
The vendor has some documentation [2] but that is not complete and sufficient for Raspbian Stretch.
Following are the changes that I made to make it work.
$ sudo apt-get update
$ sudo apt-get install lirc
# Add the following lines to /etc/modules file
lirc_dev
lirc_rpi gpio_in_pin=18 gpio_out_pin=17
@seanmhanson
seanmhanson / ableismSanityCheck.md
Created April 3, 2017 16:17
Ableist Language in Code: Sanity Check

Ableist Language in Code: Sanity Check

Removing ableist language in code is important; it helps to create and maintain an environment that welcomes all developers of all backgrounds, while emphasizing that we as developers select the most articulate, precise, descriptive language we can rather than relying on metaphors. Quite simply, avoiding ableist language lets us make sure we are inclusive of all developers, while moving toward language that is simultaneously more acccessible to developers whose first language might not be our own.

The phrase sanity check is ableist, and unnecessarily references mental health in our code bases. It denotes that people with mental illnesses are inferior, wrong, or incorrect, and the phrase sanity continues to be used by employers and other individuals to discriminate against these people.

There are a ton of alternatives, and one of the best ways to select one is to ask yourself: What am I actually checking? and select something more descriptive. In everyday c

@oifland
oifland / Jenkinsfile
Last active March 23, 2024 17:59
Loops in Jenkinsfiles
// Related to https://issues.jenkins-ci.org/browse/JENKINS-26481
abcs = ['a', 'b', 'c']
node('master') {
stage('Test 1: loop of echo statements') {
echo_all(abcs)
}
stage('Test 2: loop of sh commands') {
@altercation
altercation / xmonad.hs
Created January 10, 2017 03:02
XMonad Config for video bug report re: screenlock obscured by windows after switching displays
{-# LANGUAGE AllowAmbiguousTypes, DeriveDataTypeable, TypeSynonymInstances, MultiParamTypeClasses #-}
-- a little messy, I know, but it's WIP
---------------------------------------------------------------------------
-- Ethan Schoonover <es@ethanschoonover.com> @ethanschoonover --
-- https://github.com/altercation --
---------------------------------------------------------------------------
-- current as of XMonad 0.12
@joakin
joakin / README.md
Last active January 14, 2019 18:55
Collapse repeated unread notifications in phabricator
@drmalex07
drmalex07 / README-setup-tunnel-as-systemd-service.md
Last active March 15, 2024 15:56
Setup a secure (SSH) tunnel as a systemd service. #systemd #ssh #ssh-tunnel #ssh-forward

README

Create a template service file at /etc/systemd/system/secure-tunnel@.service. The template parameter will correspond to the name of target host:

[Unit]
Description=Setup a secure tunnel to %I
After=network.target