Skip to content

Instantly share code, notes, and snippets.

@kivS
kivS / promote.js
Created October 9, 2022 20:52
Deno script to promote a HugoJS draft post(https://gist.github.com/kivS/5645237e225528976fd290fa07d18bcf) into a published post. It replaces some front matter to reflect the change and the filename
#! /usr/bin/env -S deno run --allow-run --allow-read --allow-write
/**
*
* Promotes a draft article to a published article.
*
* select the article to promote(or use the last one modified by default),
* we then remove the draft suffix out of file and title
*
*/
@kivS
kivS / new.js
Last active October 9, 2022 20:53
Deno script to generate a new draft for HugoJS - It generates the filename slug out of the title and creates a temp draft file that can then be promoted to a published post(https://gist.github.com/kivS/eae315c78de6d9a3e515f7c866afab9f)
#!/usr/bin/env -S deno run --allow-run
/**
*
* Creates a new draft article.
* @input title - The title of the article
*
* The title gets slugified and used as the filename. A marking(" 0- ") is added to show this is a draft.
*
**/
@kivS
kivS / build.py
Last active March 9, 2022 21:46
script to generate a chrome extension zip package whilst ignoring certain files. Assumes chrome extension code is inside a directory called `src`
#! /usr/bin/python3
''' Creates a zip file from src folder into a build directory '''
import os
import zipfile
import glob
APP_NAME = 'Fluctus'
BUILD_DIR = 'build' # where zip package will be stored
@kivS
kivS / video_audio_check.html
Last active April 17, 2021 14:54
Video & sound check in one html page
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Video & Mic Check</title>
</head>
<style>
.mirror-frame{

Keybase proof

I hereby claim:

  • I am kivs on github.
  • I am mr_sir (https://keybase.io/mr_sir) on keybase.
  • I have a public key ASAWG8nAB5RZ053xkheoJpu_jfS8h9q9zweTqHTtmLLsLwo

To claim this, I am signing this object:

@kivS
kivS / bitcoin_simple_proof_of_work.py
Last active January 12, 2018 16:47
Simple Proof-of-Work Algorithm( Python3.6) based on Mastering Bitcoin by Andreas Antonopoulos
import hashlib
import time
def proof_of_work(header, difficulty_bits):
# calculate the difficulty target
# the target decreases as the difficulty_bits increases
target = 2 ** (256 - difficulty_bits)
for nonce in range(max_nonce):