Skip to content

Instantly share code, notes, and snippets.

@shariq
shariq / unfollow.js
Created May 27, 2021 19:27
Twitter mass unfollow
// go to your "following" tab
// run the following in your console
function unfollow() {
document.querySelector('div[data-testid$="unfollow"]').click();
document.querySelector('div[data-testid$="confirmationSheetConfirm"]').click();
}
setInterval(unfollow, 500);
@shariq
shariq / nato-tide.py
Created November 29, 2019 09:26
fail to solve nato tide challenge
'''
the gif with the challenge image can be found here:
https://www.act.nato.int/images/stories/events/2018/tide-hackathon/EA-FN.gif
EA contains the message "Keep :) Hacking"
not sure what FN contains
more details on the challenge:
https://www.act.nato.int/ar16
@shariq
shariq / getArticleText.js
Last active August 18, 2020 00:44
getArticleText
// fancily gets the text content of an html page
function getArticleText() {
function textNodesUnder(node){
var all = [];
for (node=node.firstChild;node;node=node.nextSibling){
if (node.nodeType==3) all.push(node);
else all = all.concat(textNodesUnder(node));
}
return all;

Keybase proof

I hereby claim:

  • I am shariq on github.
  • I am shariq (https://keybase.io/shariq) on keybase.
  • I have a public key whose fingerprint is 6D22 0EAA 8BED E070 3CEB C1DD 2235 8140 D8AF 3FEF

To claim this, I am signing this object:

function x() {document.getElementById('guess-input').value = (function() {function r(r){return n(r.reduce(function(r,n){return Math.max(r,n.length)},0)).map(function(t,a){return n(r.length).map(function(n,t){return r[t][a]})})}function n(r){return new Array(r+1).join("0").split("").map(Number)}function t(r,n,t){var a=[];for(var e in r[n])r[t][e]&&a.push(e);var o=a.length;if(0==o)return 0;for(var u=0,f=0;f<a.length;f++)u+=r[n][a[f]];for(var h=0,f=0;f<a.length;f++)h+=r[t][a[f]];for(var i=0,f=0;f<a.length;f++)i+=Math.pow(r[n][a[f]],2);for(var m=0,f=0;f<a.length;f++)m+=Math.pow(r[t][a[f]],2);for(var l=0,f=0;f<a.length;f++)l+=r[n][a[f]]*r[t][a[f]];var p=l-u*h/o,c=Math.sqrt((i-Math.pow(u,2)/o)*(m-Math.pow(h,2)/o));return 0==c?0:p/c}return '0.'+-Math.round(100*t(r(Array.prototype.map.call(document.getElementsByClassName("nv-point"),function(r){return m=r.transform.animVal[0].matrix,[m.e,m.f]})),0,1)).toString()})();document.getElementById('submit-btn').click();document.getElementById('next-btn').click();}
I was trying to solve this conundrum:
http://www.datagenetics.com/blog/december12014/index.html
So I tried to solve the problem in the general case with n squares, instead of 64 for a chess board. I show that the problem is equivalent to solving the graph coloring problem with n colors of a graph where vertices represent every bit string of length n and edges connect all vertices which are exactly Hamming distance 2 away from each other. I found a few symmetries but not even close to enough to solve the problem in the general case for 64 squares.
Here's my rough writeup:
===================
attempting solution for http://www.datagenetics.com/blog/december12014/index.html