This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
convert the below clojure language to javascript | |
(= gravity* 1.8 timebase* 120 front-threshold* 1 | |
nourl-factor* .4 lightweight-factor* .17 gag-factor* .1) | |
(def frontpage-rank (s (o scorefn realscore) (o gravity gravity*)) | |
(* (/ (let base (- (scorefn s) 1) | |
(if (> base 0) (expt base .8) base)) | |
(expt (/ (+ (item-age s) timebase*) 60) gravity)) | |
(if (no (in s!type 'story 'poll)) .8 | |
(blank s!url) nourl-factor* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// works on Edge and Chrome Devtools | |
$$(".app .wrapper").forEach(el => { el.style.maxWidth = 'none' }) | |
$$(".app .container .container-right").pop().style.maxWidth = 'none' | |
// HOW-TO | |
// Paste the above script in devtools console and press enter to apply changes | |
// Note: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Error handling | |
Links: | |
- https://fettblog.eu/rust-enums-wrapping-errors/ | |
- https://www.lpalmieri.com/posts/error-handling-rust/ | |
Cookbook on error scenarios | |
- https://rust-lang-nursery.github.io/rust-cookbook/errors/handle.html | |
- What do Etcd, Consul, and Zookeeper do?
- Service Registration:
- Host, port number, and sometimes authentication credentials, protocols, versions numbers, and/or environment details.
- Service Discovery:
- Ability for client application to query the central registry to learn of service location.
- Consistent and durable general-purpose K/V store across distributed system.
- Some solutions support this better than others.
- Based on Paxos or some derivative (i.e. Raft) algorithm to quickly converge to a consistent state.
- Service Registration:
- Centralized locking can be based on this K/V store.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://stackoverflow.com/questions/3455625/linux-command-to-print-directory-structure-in-the-form-of-a-tree |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//https://ekyc.aircel.com:444/ekyc/genUPC.html | |
//this site uses angularjs | |
//let take advantage of developer tools console tab | |
//lets grab the http service of anugular js | |
$http = angular.element(document.body).injector().get('$http') | |
//so now, lets have a handy function to send post request | |
//returns promise | |
function sendPost(simnum){ return $http.post('https://ekyc.aircel.com:444/ekyc/rest/genUPC', {"service_id":"WEB_UPC","msisdn":"919768XXXXXX","sim":simnum})} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"sync" | |
"time" | |
) | |
func main() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from selenium import webdriver | |
from selenium.webdriver.common.by import By | |
from selenium.webdriver.support.ui import Select, WebDriverWait | |
from selenium.webdriver.support import expected_conditions as EC | |
from time import sleep, strftime | |
def waituntil(s): | |
while strftime('%H:%M:%S') < s: | |
print strftime('%H:%M:%S') | |
sleep(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var crypto = require("crypto") | |
function encrypt(key, data) { | |
var cipher = crypto.createCipher('aes-256-cbc', key); | |
var crypted = cipher.update(text, 'utf-8', 'hex'); | |
crypted += cipher.final('hex'); | |
return crypted; | |
} |
NewerOlder