Skip to content

Instantly share code, notes, and snippets.

View hermanschaaf's full-sized avatar

Herman Schaaf hermanschaaf

View GitHub Profile
@hermanschaaf
hermanschaaf / diff.txt
Created January 18, 2024 11:58
Services mentioned in AWS ReadOnlyAccess policy but not in ViewOnlyAccess
a4b
access-analyzer
account
acm-pca
airflow
amplify
aoss
apigateway
appconfig
appfabric
@hermanschaaf
hermanschaaf / revert-to-commit.md
Created October 7, 2019 08:08
Revert back to a specific commit

So you want to create a revert commit for a lot of commits, and git revert HEAD~10..HEAD isn't working because there are merge commits in between? Here's a workaround using a patch file:

git checkout master
git pull origin master
git log --oneline # find the hash of the commit you want to revert to
git checkout <hash>
git checkout -b my-revert-branch
git diff master > mypatch.patch
git checkout master
@hermanschaaf
hermanschaaf / adjust_video_speed.md
Last active April 9, 2023 01:17
Adjust Speed of a Video with ffmpeg

To increase speed of a video by a factor of 1.5x:

ffmpeg -i input.mp4 -filter_complex "[0:v]setpts=PTS/1.5[v];[0:a]atempo=1.5[a]" -map "[v]" -map "[a]" output.mp4

We can use this to adjust the speed of all the videos in a directory (Linux and macOS only):

mkdir -p output
@hermanschaaf
hermanschaaf / hn_seach.js
Last active August 2, 2016 04:11 — forked from kristopolous/hn_seach.js
hn job query search
function query() {
var
// HN is done with very unsemantic classes.
job_list = Array.prototype.slice.call(document.querySelectorAll('.c5a,.cae,.c00,.c9c,.cdd,.c73,.c88')),
query_list = Array.prototype.slice.call(arguments),
shown = 0, total = job_list.length;
// Traverses up the dom stack trying to find a match of a specific class
function up_to(node, klass) {
if (node.classList.contains(klass)) {
@hermanschaaf
hermanschaaf / gist:8505510
Created January 19, 2014 14:11
Scoring Combinations to Achieve Any One Total Score in a Game of Rugby. Original post at http://ironzebra.com/algorithms/112/
Score Kicks Tries Tries+Conversions
0 0 0 0
3 1 0 0
5 0 1 0
6 2 0 0
7 0 0 1
8 1 1 0
9 3 0 0
10 1 0 1
0 2 0
@hermanschaaf
hermanschaaf / Rugby Minimum Opportunities
Last active January 3, 2016 18:59
Minimum Scoring Opportunities needed to Reach Specific Scores in a Game of Rugby For more details, see the [original IronZebra blog post](http://ironzebra.com/algorithms/112).
Points | Minimum Scoring Opportunities
0 0
1 -1
2 -1
3 1
4 -1
5 1
6 2
7 1
8 2
@hermanschaaf
hermanschaaf / gist:6764574
Created September 30, 2013 14:23
Wiktionary example
<page>
<title>牽拖</title>
<ns>0</ns>
<id>1357605</id>
<revision>
<id>3938210</id>
<parentid>3938209</parentid>
<timestamp>2013-05-26T04:14:41Z</timestamp>
<contributor>
<username>Kanashimi</username>