Skip to content

Instantly share code, notes, and snippets.

View zhihuitang's full-sized avatar
😜

Zhihui Tang zhihuitang

😜
View GitHub Profile
@webcpu
webcpu / monitor.py
Last active June 28, 2019 21:28
Reboot ethOS when any miner's hash rate is too low.
#!/usr/bin/env python3
import os
# 1. Save this file in /home/ethos/monitor.py on your ethOS
# 2. Change permission to make it executable
# chmod 0755 /home/ethos/monitor.py
# 3. Run crontab
# # crontab -e
# 4. Schedule a cron task to execute every 5 minutes
"""
var CryptoJS = require('crypto-js')
var request = require('request-promise')
/*
* npm install crypto-js request-promise request
* node wx_t1t_hack.js
*/
// export function testEncription(msg, fullKey) {
// var fullKey = fullKey.slice(0, 16)
@pandafulmanda
pandafulmanda / Python3 Virtualenv Setup.md
Last active March 12, 2024 15:59 — forked from akszydelko/Python3 Virtualenv Setup.md
Setting up and using Python3 Virtualenv on Mac

Python3 Virtualenv Setup

Requirements
  • Python 3
  • Pip 3
$ brew install python3
@myusuf3
myusuf3 / delete_git_submodule.md
Created November 3, 2014 17:36
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@calebd
calebd / AsynchronousOperation.swift
Last active April 29, 2023 13:12
Concurrent NSOperation in Swift
import Foundation
/// An abstract class that makes building simple asynchronous operations easy.
/// Subclasses must implement `execute()` to perform any work and call
/// `finish()` when they are done. All `NSOperation` work will be handled
/// automatically.
open class AsynchronousOperation: Operation {
// MARK: - Properties
@shadcn
shadcn / gist:de147c42d7b3063ef7bc
Last active September 17, 2022 11:50
Convert a Hex string to UIColor in Swift
// Creates a UIColor from a Hex string.
func colorWithHexString (hex:String) -> UIColor {
var cString:String = hex.stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceAndNewlineCharacterSet()).uppercaseString
if (cString.hasPrefix("#")) {
cString = cString.substringFromIndex(1)
}
if (countElements(cString) != 6) {
return UIColor.grayColor()