Skip to content

Instantly share code, notes, and snippets.

Watch or unwatch GitHub repositories using GitHub API + curl + jq + Bash

When you need to perform an operation on a large number of GitHub repositories, their REST API and some command line magic comes in handy. This short talk will demonstrate a technique to watch and unwatch GitHub repositories using ad-hoc scripts. The example should give a good idea how to perform other bulk operations too.

Background...

I have this setting in my personal GitHub account:

@janosgyerik
janosgyerik / sonar-notes.md
Last active May 16, 2016 17:13
Notes related to contributing to Sonar

###[Q] Example code I'm afraid this question does not match what this site is about. Code Review is about improving existing, working code. The example code that you have posted is not reviewable in this form because it leaves us guessing at your intentions. Unlike Stack Overflow, Code Review needs to look at concrete code in a real context. Please see Why is hypothetical example code off-topic for CR?

###[Q] Add an intro I suggest to add a nice introductory paragraph at the very beginning of your post, explaining briefly what your code does. It will look more attractive on question listing pages. If you start with a block of code, the summary of your question will be "..." instead of something meaningful.

###[Q] Broken code Welcome to $SITENAME$! I'm afraid this question does not match what this site is about. $SITENAME$ is about improving existing, working code. $SITENAME$ is not the site to ask for help in fixing or changing what your code does.

@janosgyerik
janosgyerik / find-pattern-in-zips.sh
Created December 16, 2013 19:17
Find a pattern in all zip files in the current directory and print a report with the number of matches, the answer for: http://stackoverflow.com/questions/20618515/how-to-find-a-pattern-in-text-files-within-zip-files-and-print-the-number-of-mat
#!/bin/bash -e
pattern=$1
for zip in *.zip; do
while IFS=: read fn count; do
echo Zip File : $zip has text file : $fn has $pattern $count times
done < <(zipgrep -c "$1" "$zip" | grep -v :0)
done
@janosgyerik
janosgyerik / winterbash2013.md
Last active December 31, 2015 12:09
stack overflow winter bash hats

http://winterbash2013.stackexchange.com/

  • 5 reviews in 5 queues
  • award bounty
  • starred chat on NYD
  • 5+ helpful flags, <= 20% declined
  • edit a cw post
  • reopen or undelete question
  • gold badge
  • first post scored 1+
#!/usr/bin/env python
import sys
s1 = sys.argv[1]
s2 = sys.argv[2]
def longest(s1, s2):
def longest(i):
suffix = s2[i:]
if s1.startswith(suffix):
#!/bin/sh
cat /home/level02/.password
EMAIL=janos@example.com
function mailme() {
file=$1
if test -f $file; then
uuencode $file $file.txt | mailx -s $file $EMAIL
else
mailx $* $EMAIL
fi
}