Skip to content

Instantly share code, notes, and snippets.

View yangwao's full-sized avatar
🥋
Mastering the code

Matej yangwao yangwao

🥋
Mastering the code
View GitHub Profile
@yangwao
yangwao / nginx-and-certbot-config.md
Created August 1, 2018 10:38 — forked from rkaramandi/nginx-and-certbot-config.md
Running NGINX and CertBot Containers on the Same Host

Running NGINX and CertBot Containers on the Same Host

The Problem

A lot of people run into the problem of running Let's Encrypt's CertBot Tool and an NGINX on the same container host. A big part of this has to do with CertBot needing either port 80 or 443 open for the tool to work as intended. This tends to conflict with NGINX as most people usually use port 80 (HTTP) or 443 (HTTPS) for their reverse proxy. Section 1 outlines how to configure NGINX to get this to work, and Section 2 is the Docker command to run CertBot.

1. NGINX Configuration

I use Docker Compose (docker-compose) for my NGINX server. My docker-compose.yml file looks something like this:

import Keyring from '@polkadot/keyring';
public mnemonicGenerate(): void {
this.mnemonicGenerated = mnemonicGenerate();
this.keyring = new Keyring();
}
public validateMnemonic(): void {
this.isValidMnemonic = mnemonicValidate(this.mnemonicGenerated);
}
import { schnorrkelVerify } from '@polkadot/util-crypto';
public signData(): void {
this.signedData = u8aToHex(
this.currentPair.sign(stringToU8a(this.toSign.data)));
this.toSign.signature = this.signedData;
}
public verifySignature(): void {
if (isHex(this.toVerify.signature)) {
@yangwao
yangwao / vue.json
Created March 25, 2020 14:00
Vue Typescript Template Component Snippet for Vetur with vue-property-decorator
{
"vue typescript w decorator": {
"prefix": "<template Typescript 😁",
"body": [
"<template>"
" <div>"
"\n"
" </div>"
"</template>"
"<script lang=\"ts\" >"
{
"ProposalRecord": {
"index": "u32",
"author": "AccountId",
"stage": "VoteStage",
"transition_time": "u32",
"title": "Text",
"contents": "Text",
"vote_id": "u64"
},
{
"ProposalRecord": {
"index": "u32",
"author": "AccountId",
"stage": "VoteStage",
"transition_time": "u32",
"title": "Text",
"contents": "Text",
"vote_id": "u64"
},
@yangwao
yangwao / ksm.py
Last active February 1, 2021 15:17 — forked from vikiival/ksm.py
Price of Edgeware for last 30 days
from pycoingecko import CoinGeckoAPI
import datetime
from statistics import median, mean
cg = CoinGeckoAPI()
def main():
numdays = 30
base = datetime.datetime.today()
date_list = [base - datetime.timedelta(days=x) for x in range(numdays)]
fn_format = lambda x: x.strftime("%d-%m-%Y")

On Feb. 21, 2010, a con­voy of vehicles car­ry­ing ci­vil­ians headed down a moun­tain in cent­ral Afgh­anistan. Amer­ic­an eyes were watch­ing. For more than four hours, the U.S. mil­it­ary — in­clud­ing a Pred­at­or drone crew in Nevada, video screen­ers in Flor­ida, an AC-130 air­plane crew in the sky and an Amer­ic­an spe­cial op­er­a­tions unit on the ground nearby — tracked the con­voy, try­ing to de­cide wheth­er it was friend or foe. This is the of­fi­cial U.S. mil­it­ary tran­script of the ra­dio trans­mis­sions and cock­pit con­ver­sa­tions that day, ob­tained by the Los Angeles Times through a Free­dom of In­form­a­tion Act re­quest.

This is a cleaned up copy of the transcript obtained by the LA Times, retrieved from http://documents.latimes.com/transcript-of-drone-attack/

I downloaded the PDF, ran pdf2txt on it, ran the following Python program to clean it up, then did manual edits.

import sys
20:44:20 ❯ cat useforce.sh
#!/bin/bash
osascript sidecar.scpt
~
20:44:22 ❯ cat sidecar.scpt
#!/usr/bin/env osascript
set controlCenterName to "Control Centre"
set connectToSidecarName to "Connect to Sidecar"