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
{
"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 / 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\" >"
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)) {
import Keyring from '@polkadot/keyring';
public mnemonicGenerate(): void {
this.mnemonicGenerated = mnemonicGenerate();
this.keyring = new Keyring();
}
public validateMnemonic(): void {
this.isValidMnemonic = mnemonicValidate(this.mnemonicGenerated);
}
@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:

"curl - request POST - url https://api.telegram.org/bot575419417:AAEmmflOhwgZnMsut0ibQn1gY6i7Ym7q05Y/setWebhook - header 'content-type: application/json' - data '{"url": "https://JanethL.lib.id/replybot@dev/"}"
@yangwao
yangwao / post.json
Created May 17, 2018 18:34
http request
⫸ http -b POST https://api.telegram.org/bot180473239:VHqX8dOnuhGlJXyurVHqX8dO8yhqX8/setWebhook url=https://yangwao.lib.id/replybot@dev/
{
"description": "Webhook was set",
"ok": true,
"result": true
}
const r2 = require('r2')
const telegramUrl = 'https://api.telegram.org/bot'
const token = '180473239:VHqX8dOnuhGlJXyurVHqX8dO8yhqX8'
/**
* A basic reply bot
* @returns {object}
*/
module.exports = async (context) => {
const m = context.params.message