This cookbook is used to create a VM image for GCP using Packer.
packer {
required_plugins {
googlecompute = {| #!/usr/bin/env python3 | |
| """Scrub sensitive values in a JSON file. | |
| Usage: | |
| python scrub.py <file> <json_path> | |
| The JSON path supports: | |
| - JSON Pointer (e.g. `/env`) | |
| - Dot notation (e.g. `env` or `users[0].token`) | |
| """ |
| # /// script | |
| # dependencies = ["pyseccomp"] | |
| # /// | |
| import sys | |
| try: | |
| import seccomp | |
| except ImportError: | |
| import pyseccomp as seccomp |
| import cv2 | |
| qcd = cv2.QRCodeDetector() | |
| def read_qr(user): | |
| filename = user['images'][1] | |
| image = f'mount-folder/kyc/images/{filename}' | |
| try: | |
| data, points, _ = qcd.detectAndDecode(cv2.imread(image)) | |
| if points is None: | |
| return (user, None) | |
| return (user, data) |
| use std::io::Result; | |
| use esp_idf_sys::*; | |
| use smart_leds::hsv::{hsv2rgb, Hsv}; | |
| use smart_leds::SmartLedsWrite; | |
| use std::thread::sleep; | |
| use std::time::Duration; | |
| use ws2812_esp32_rmt_driver::Ws2812Esp32Rmt; | |
| fn main() -> Result<()> { |
| #include <iostream> | |
| #include <vector> | |
| #include <chrono> | |
| #include <thread> | |
| #include <termios.h> | |
| #include <unistd.h> | |
| #include <stdio.h> | |
| #include <fcntl.h> |
| #include <iostream> | |
| #include <cassert> | |
| #include <vector> | |
| using namespace std; | |
| struct tree_node { | |
| int value; | |
| int l, r; | |
| tree_node *left, *right; |
| #include <algorithm> | |
| #include <iostream> | |
| #include <cassert> | |
| #include <cstdint> | |
| #include <vector> | |
| #include <stack> | |
| #include <map> | |
| using namespace std; |
| from typing import Callable, Sequence | |
| from random import randint | |
| def monte_carlo_3_plus_1(n: int) -> float: | |
| i = 0 | |
| positive = 0 | |
| while i < n: | |
| counts = [0] * 4 | |
| a1 = randint(0, 3) | |
| counts[a1] += 1 |