This file contains hidden or 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
| #!/usr/bin/env python3 | |
| ''' A basic bloom filter implementation''' | |
| from bitarray import bitarray | |
| from hashlib import sha256 | |
| import math | |
| def h_i(i, m, s): | |
| ''' | |
| Our "uniformly distributed" hash function: h_i(s) = sha256(s + i) % m |
This file contains hidden or 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
| ### Keybase proof | |
| I hereby claim: | |
| * I am dannycroft on github. | |
| * I am dannycroft (https://keybase.io/dannycroft) on keybase. | |
| * I have a public key ASCOJTYfcKRcaND9PnQqyF-0XeDeh7q8zaU5CgHPWeqYhAo | |
| To claim this, I am signing this object: |
This file contains hidden or 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
| [{ | |
| "type": "container", | |
| "title": "Registry", | |
| "description": "Docker image registry", | |
| "categories": ["docker"], | |
| "platform": "linux", | |
| "logo": "https://cloudinovasi.id/assets/img/logos/registry.png", | |
| "image": "registry:latest", | |
| "ports": [ | |
| "5000/tcp" |
This file contains hidden or 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
| aws --output table ec2 describe-instances --query 'Reservations[].Instances[].[Tags[?Key==`Name`] | [0].Value,InstanceId,InstanceType]' |
This file contains hidden or 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
| const log = new Proxy({}, { | |
| get: (_, color) => (...args) => { | |
| console.log(`%c ${args.join(' ')}`, `color: ${color}`); | |
| } | |
| }); | |
| // example | |
| log.tomato('I am tomato'); | |
| log.chocolate('I am chocolate'); | |
| log.cornflowerblue('I am cornflowerblue'); |
This file contains hidden or 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
| #!/bin/sh | |
| sudo apt-get update \ | |
| && sudo apt-get install -qy docker.io | |
| sudo apt-get update \ | |
| && sudo apt-get install -y apt-transport-https \ | |
| && curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - | |
This file contains hidden or 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
| /* ----------------------------------------------------------------------------- | |
| Complete the following tasks using only browser based APIs. Update | |
| the supplied "getUsers()" function to achieve the following: | |
| - Make a request to the API_URL (see below) | |
| - Return a Promise | |
| - Parse each of the returned results to match the example below: | |
| [ |
This file contains hidden or 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
| import EventEmitter from 'events'; | |
| import onFinished from 'on-finished'; | |
| /* | |
| * RequestQueue to ensure that only a single request is executing at a time. | |
| * | |
| * This middleware intercepts requests as they come in by delaying executing of | |
| * next() until previous requests finish processing. This complements external | |
| * server configuration via haproxy or similar that restricts concurrent | |
| * requests. This per-process queue allows an application level guarantee of |
This file contains hidden or 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
| import os | |
| # Return CPU temperature as a character string | |
| def getCPUtemperature(): | |
| res = os.popen('vcgencmd measure_temp').readline() | |
| return(res.replace("temp=","").replace("'C\n","")) | |
| # Return RAM information (unit=kb) in a list | |
| # Index 0: total RAM | |
| # Index 1: used RAM |
This file contains hidden or 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
| /* ------------------------------- */ | |
| /* common/errorHandler.js */ | |
| /* ------------------------------- */ | |
| const asyncUtil = fn => | |
| function asyncUtilWrap(...args) { | |
| const fnReturn = fn(...args) | |
| const next = args[args.length-1] | |
| return Promise.resolve(fnReturn).catch(next) | |
| } |