Skip to content

Instantly share code, notes, and snippets.

Avatar

Moshe MosheBerman

View GitHub Profile
View ancestry_saver.js
/**
* 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.
View ancestry_saver.js
/**
* 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.
View szukajwarchiwach_filter.js
/**
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 Jun 4, 2020
Automate DNA Clustering on Ancestry.com
View ancestry_clustering_ui_driver.js
/**
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 Jan 10, 2019
Too many "pro" tier repos?
View gcoco.py
import requests
print "####################################"
print "# GitHub Collaborator Counter v1.0 #"
print "####################################"
access_token = None
if access_token is None:
View statusBarTint.swift
// 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
}
View locator-encapsulate-this.js
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 Jul 24, 2017
A JS object/function to locate a user with `navigator.geolocation`.
View locator-arrow.js
function Locator(successCallback, errorCallback)
{
this.success = (location) =>
{
console.dir(location);
this.pauseLocationUpdates();
successCallback(location);
};
@MosheBerman
MosheBerman / StatusBarHack.swift
Created Mar 20, 2017
Set the Status Bar Color on iOS...
View StatusBarHack.swift
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 Sep 21, 2016
A way to send the best and worst of classical literature over APNs.
View fcm_test_literature.py
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"