Skip to content

Instantly share code, notes, and snippets.

@r2DoesInc
r2DoesInc / check_hashrate_reboot.py
Created February 24, 2018 04:32 — forked from jaydlawrence/check_hashrate_reboot.py
Script to check the hashrate of ethereum worker on ethOs and reboot if the hashrate is 0 for 2 runs of this script. This script is for a single GPU, or rather it will only reboot if the overall hashrate reaches 0. It also uses the pushover service to push notifications for when the script triggers a reboot.
import subprocess
import os
import re
import sys
import argparse
import httplib, urllib
import time
"""
# place this file at /home/ethos/check_hash_reboot.py
@r2DoesInc
r2DoesInc / check_hashrate_reboot.py
Last active February 27, 2018 23:29 — forked from jaydlawrence/check_hashrate_reboot.py
Script to check the hashrate of ethereum worker on ethOs and reboot if the hashrate is below the minimum for 2 runs of this script. This script is for any amount of gpus, or rather it will only reboot if the overall hashrate fallen below the specified hashrate. It also uses the pushover service to push notifications for when the script triggers …
import subprocess
import os
import re
import sys
import argparse
import httplib, urllib
import time
"""
# place this file at /home/ethos/check_hash_reboot.py
@r2DoesInc
r2DoesInc / jdk7.sh
Created June 20, 2017 15:20
jdk 7 setup
apt-get install software-properties-common debian-archive-keyring -y
add-apt-repository 'deb http://httpredir.debian.org/debian experimental main'
add-apt-repository 'deb http://httpredir.debian.org/debian sid main'
cat >/etc/apt/preferences.d/debian <<EOL
Package: *
Pin: release o=Debian,n=experimental
Pin-Priority: -1
Package: *
@r2DoesInc
r2DoesInc / gist:da7929eb31756a915e48
Last active October 14, 2015 05:51
Marvin Current Version
{
version_code: 2,
content: "Version 1.0.1"
}
@r2DoesInc
r2DoesInc / _service.md
Created October 6, 2015 04:10 — forked from naholyr/_service.md
Sample /etc/init.d script

Sample service script for debianoids

Look at LSB init scripts for more information.

Usage

Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
@r2DoesInc
r2DoesInc / gist:bdcba8245fc3933bf679
Created September 1, 2014 06:13
Is there mail JS}
function doesTheMailRunToday(today)
{
var reason = '';
if (today.is().sunday())
reason = "It's Sunday.";
else if (today.equals(Date.parse("January 1")))
reason = "It's New Year's.";
else if (today.equals(Date.january().third().monday()))
reason = "It's Martin Luther King Day.";
else if (today.equals(Date.february().third().monday()))
@r2DoesInc
r2DoesInc / MainActivity
Created August 18, 2014 13:54
Third Party iap style verification
//Called in onCreate
private void setupInstall() {
InstallObject install = new SettingsProvider(this).getInstallObject();
if (install == null || install.getFirstInstall() == -1) {
ParseInstallObject.createInstall(this,
new ParseInstallObject.IParseInstallFinished() {
@Override
public void finished(ParseInstallObject obj) {
new SettingsProvider(MainActivity.this)
.setParseInstallObject(obj);
@r2DoesInc
r2DoesInc / pre-commit
Created June 2, 2014 14:32
Git hook to bump versionCode and versionName on every commit
#!/bin/sh
#Define Manifest file and current versionCode.
manf=AndroidManifest.xml
versCode=`sed -n '/versionCode=/s/.*"\([0-9][0-9]*\)".*/\1/p' $manf`
#versionCode is a number, so simply add 1.
newVersCode=$((versCode + 1))
#Swap old versionCode with new versionCode and write it to the file
sed /versionCode=/s/'"'$versCode'"'/'"'$newVersCode'"'/ $manf >new$manf && cp new$manf $manf && rm -f new$manf
@r2DoesInc
r2DoesInc / Utility.java-mod
Created March 19, 2014 14:23
Set Facebook app id based on signature
In the Facebook SDK, find Utility.java and modify the method getMetadataApplicationId as follows, where TESTING_KEY is the signature of the Android DEBUG key on your machine that Eclipse uses when you select the "Run" option.
If the code detects youre using that DEBUG key, it uses one of the sample Facebook SDK app ids, otherwise it uses the value defined in the manifest. Useful to avoid having to change the app id when compiling a release candidate vs an internal testing build generated by Eclipse.
public static String getMetadataApplicationId(Context context) {
Validate.notNull(context, "context");
Signature[] appSigs;
try {
appSigs = context.getPackageManager().getPackageInfo(