Skip to content

Instantly share code, notes, and snippets.

View swrdfish's full-sized avatar
🎯
Focusing

Binayak Ghosh swrdfish

🎯
Focusing
View GitHub Profile
@swrdfish
swrdfish / LongBitSet.java
Created August 31, 2022 05:45
Java BitSet with which takes in long index values (taken from Apache Lucene)
import java.util.Arrays;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
@swrdfish
swrdfish / wget
Created April 15, 2019 19:43
Download a webpage with all assets
wget --mirror --convert-links --adjust-extension --page-requisites --no-parent --level=1 http://example.org
@swrdfish
swrdfish / trigger.js
Created March 2, 2017 15:40
Trigger mouse events on element
var dispatchMouseEvent = function(target, var_args) {
var e = document.createEvent("MouseEvents");
// If you need clientX, clientY, etc., you can call
// initMouseEvent instead of initEvent
e.initEvent.apply(e, Array.prototype.slice.call(arguments, 1));
target.dispatchEvent(e);
};
# Make a fresh clone of the repository
git clone ...
# Create tracking branches of all branches
for remote in `git branch -r | grep -v /HEAD`; do git checkout --track $remote ; done
# Remove DIRECTORY_NAME from all commits, then remove the refs to the old commits
# (repeat these two commands for as many directories that you want to remove)
git filter-branch --index-filter 'git rm -rf --cached --ignore-unmatch DIRECTORY_NAME/' --prune-empty --tag-name-filter cat -- --all
git for-each-ref --format="%(refname)" refs/original/ | xargs -n 1 git update-ref -d