Skip to content

Instantly share code, notes, and snippets.

View noj's full-sized avatar

Jon Olsson noj

  • Stockholm, Sweden
View GitHub Profile
#include <iostream>
template <std::size_t N, typename T>
inline static T
divmod (T & val) noexcept
{
T rest = val;
val /= N;
return rest % N;
}
from math import radians, degrees, atan2, sin, cos
class GpsPoint:
lat: float
lon: float
def __init__(self, lat: float, lon: float):
self.lat = lat
self.lon = lon
@noj
noj / main.rs
Created February 2, 2023 19:47
// vim: ts=3 sw=3
use axum::{
extract::State,
response::IntoResponse,
routing::{get, post},
Json, Router,
};
use serde_derive::{Deserialize, Serialize};
use std::collections::BTreeMap;
use std::env;
@noj
noj / main.rs
Created February 2, 2023 19:36
// vim: ts=3 sw=3
use axum::{
extract::State,
response::IntoResponse,
routing::{get, post},
Json, Router,
};
use serde_derive::{Deserialize, Serialize};
use std::collections::BTreeMap;
use std::env;
#include "codec/blink/Types.h"
#include "doctest/doctest.h"
#include <vector>
namespace Sequitor::Blink::Utest
{
// Bill/2 -> u32 Amount, u32 Tip?
struct Bill : Obj<Bill>
{
u32 getAmount () const { return amount.value; }
#pragma once
namespace Sequitor::Blink
{
//! Blink native
//!
//! | 32-bit length | 64-bit type id | 32-bit extension offset | fields... |
//!
//! * Dynamically sized data values are allocated in a data area after the
//! fixed width fields, the inline value becomes a relative offset to the
[Unit]
Description=step-ca service
Documentation=https://smallstep.com/docs/step-ca
Documentation=https://smallstep.com/docs/step-ca/certificate-authority-server-production
After=network-online.target
Wants=network-online.target
StartLimitIntervalSec=30
StartLimitBurst=3
ConditionFileNotEmpty=/etc/step-ca/config/ca.json
ConditionFileNotEmpty=/etc/step-ca/password.txt
---
- name: "Install required packages"
tags:
- ca
- smallstep
apt: name={{ item }} state=present
with_items:
- haveged
- ufw
#!/bin/bash
set -e
echo -n "user: "
read user
echo ${user}
mkdir -p keys
import { DB } from "https://deno.land/x/sqlite/mod.ts";
class Config {
constructor(dbName: string) {
this.dbName = dbName;
const db = new DB(this.dbName);
db.query(`
CREATE TABLE IF NOT EXISTS config (
key STRING PRIMARY KEY,