Skip to content

Instantly share code, notes, and snippets.

View MosheBerman's full-sized avatar

Moshe MosheBerman

View GitHub Profile
/**
* 1. Filter matches to 6-8cM
* 2. Open the developer console in Chrome.
* 3. Paste this.
* 4. Scroll through matches. As you scroll they, will be automatically noted.
* Known bugs:
* - The first page of matches won't be automatic, but the rest will.
* - You may need to refresh the page to see notes.
*
* For educational purposes only.
/**
* 1. Filter matches to 6-8cM
* 2. Open the developer console in Chrome.
* 3. Paste this.
* 4. Scroll through matches. As you scroll they, will be automatically noted.
* Known bugs:
* - The first page of matches won't be automatic, but the rest will.
* - You may need to refresh the page to see notes.
*
* For educational purposes only.
/**
Find all of the units without zero scans.
*/
const rows = Array.from(document.getElementsByTagName("tr"));
const entries = rows.filter( (r) => { return rows.childElementCount == 4});
// This next line hides the rows with no scans.
entries.filter(e => e.children[3].innerText === "0").forEach(e => e.style.display = 'none')
@MosheBerman
MosheBerman / ancestry_clustering_ui_driver.js
Last active June 4, 2020 19:16
Automate DNA Clustering on Ancestry.com
/**
Tested in Google Chrome on macOS.
How to use:
Step 1: Navigate to Ancestry.com > DNA Matches > {A match} > Shared Matches
Step 2: Add a new custom group. (If you don't, the bottom group will be used.)
Step 2, optional: scroll down to load more shared matches. (Only loaded matches can be seen by the script.)
Step 3: Open the Developer Console.
Step 4: Paste this code into the console.
Step 5: Wait. The script is manually clicking buttons and it will take some time.
@MosheBerman
MosheBerman / gcoco.py
Last active January 10, 2019 03:42
Too many "pro" tier repos?
import requests
print "####################################"
print "# GitHub Collaborator Counter v1.0 #"
print "####################################"
access_token = None
if access_token is None:
@MosheBerman
MosheBerman / statusBarTint.swift
Created November 1, 2017 01:10
UIStatusBar Tint
// Untested on iOS 11, untested with App Review. YMMV.
// MARK: - Theming the Status Bar
private func set(statusBar color: UIColor) {
guard let statusBarWindow = UIApplication.shared.value(forKey: "statusBarWindow") as? UIWindow else
{
print("Failed to get status bar window.")
return
}
function Locator(successCallback, errorCallback)
{
var _this = this;
this.success = function(location)
{
console.dir(location);
_this.pauseLocationUpdates();
successCallback(location);
@MosheBerman
MosheBerman / locator-arrow.js
Last active July 24, 2017 16:09
A JS object/function to locate a user with `navigator.geolocation`.
function Locator(successCallback, errorCallback)
{
this.success = (location) =>
{
console.dir(location);
this.pauseLocationUpdates();
successCallback(location);
};
@MosheBerman
MosheBerman / StatusBarHack.swift
Created March 20, 2017 01:32
Set the Status Bar Color on iOS...
func setStatusBarColor(color: UIColor) {
let statusBarWindow = UIApplication.sharedApplication().valueForKey("statusBarWindow")
let statusBar = statusBarWindow!.valueForKey("statusBar")
let selector = Selector("setForegroundColor:")
if statusBar!.respondsToSelector(selector) {
statusBar!.performSelector(selector, withObject: color)
}
}
@MosheBerman
MosheBerman / fcm_test_literature.py
Created September 21, 2016 22:06
A way to send the best and worst of classical literature over APNs.
import requests
import json
url = "https://fcm.googleapis.com/fcm/send"
project_key = "token"
def send(title, text):
headers = {
"Authorization": "key={}".format(project_key),
"Content-Type": "application/json"