Skip to content

Instantly share code, notes, and snippets.

View InnovativeInventor's full-sized avatar

Max Fan InnovativeInventor

View GitHub Profile
@InnovativeInventor
InnovativeInventor / randart.c
Last active December 28, 2017 01:52 — forked from nirenjan/bishop.c
Random art for verifying signatures and files
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#define XLIM 17
#define YLIM 9
#define ARSZ (XLIM * YLIM)
#define DEBUG 0
sudo apt-get install -y curl
curl -L https://packagecloud.io/AtomEditor/atom/gpgkey | sudo apt-key add -
sudo sh -c 'echo "deb [arch=amd64] https://packagecloud.io/AtomEditor/atom/any/ any main" > /etc/apt/sources.list.d/atom.list'
sudo apt-get update
sudo apt-get install atom
@InnovativeInventor
InnovativeInventor / docker-compose.yml
Created June 20, 2018 20:54
My Gogs Docker Compose file
# Based off this discussion https://discuss.gogs.io/t/problem-with-docker-compose-to-encapsulate-gogs-with-mysql/1650 (mattddowney)
# Note: You don't actually have to change the SQL passwords if you are on an internal network.
version: '3'
services:
mysql:
image: mysql
restart: always
@InnovativeInventor
InnovativeInventor / jupyterhub.service
Created July 21, 2018 20:02
A jupyterhub service file for miniconda
[Unit]
Description=Jupyterhub
After=syslog.target network.target
[Service]
User=root
Environment="PATH=/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/home/ubuntu/miniconda3/bin"
ExecStart=/home/ubuntu/miniconda3/bin/jupyterhub -f /etc/jupyterhub/jupyterhub_config.py
[Install]
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
cat bashrc >> ~/.bashrc
sudo apt-get update
sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \
xz-utils tk-dev libffi-dev
@InnovativeInventor
InnovativeInventor / keybase.md
Created October 27, 2019 02:20
My Keybase gist

Keybase proof

I hereby claim:

  • I am innovativeinventor on github.
  • I am innovativeinvent (https://keybase.io/innovativeinvent) on keybase.
  • I have a public key ASBcQRAUj3CTYRg53KpPvLB1GrCmt5Xe6LgU_jRzqbWk5go

To claim this, I am signing this object:

There are three steps to the locking operation, the lock step (which we will refer to as lock()), the execution actual payout function (payout()), followed by the lock release (release()). We assume that all of these functions will return true if and only if the action succeeded. Specifically, we assume that lock() will return false if the atomic database operation did not modify the document and will return true when the document has been modified and the modification has been fully propagated. These are guarantees provided by MongoDB's atomic update operation (source: https://pymongo.readthedocs.io/en/stable/api/pymongo/results.html#pymongo.results.UpdateResult) and by mongodb_dataset's update result checks.

Given the lock only has two states, locked or unlocked, and if it is unlocked, lock() will succeed, lock() can only return false if the file is already locked.

This is the pseudo structure of both programs:

worker 1 (w_1):

package main
import (
"fmt"
"log"
"bufio"
"encoding/json"
"io/ioutil"
"os"
"github.com/willf/bloom"
package main
import (
"fmt"
"encoding/json"
"io/ioutil"
"github.com/willf/bloom"
)
func main() {
Developer's Certificate of Origin 1.1 (modified from the Linux kernel)
By making a contribution to this project, I certify that:
(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the repository; or
(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source