Skip to content

Instantly share code, notes, and snippets.

🎯
Focused on the global SoftUni expansion: https://softuni.org

Svetlin Nakov nakov

🎯
Focused on the global SoftUni expansion: https://softuni.org
View GitHub Profile
@nakov
nakov / README.md
Last active May 6, 2020
WordPress + MySQL on Docker Compose
View README.md

Install Docker / or use Play with Docker (https://labs.play-with-docker.com) with Docker Hub free registration.

Create the docker-compose.yml file, e.g. using cat > docker-compose.yml

Run the containers (WordPress and MySQL):

docker-compose up -d

Check the containers state:

@nakov
nakov / ListExamples.cs
Last active Apr 21, 2020
Arrays and Lists in C#, Java, Python and JavaScript
View ListExamples.cs
// List examples in C#
using System;
using System.Collections.Generic;
using System.Linq;
class ListExamples
{
static void Main()
{
@nakov
nakov / FormBulbController.cs
Last active Jan 19, 2020
ESP8266 with Thinger.io for Bulb control
View FormBulbController.cs
using System;
using System.Net.Http;
using System.Windows.Forms;
namespace ESP8266BulbControl
{
public partial class FormBulbController : Form
{
HttpClient http = new HttpClient();
@nakov
nakov / kinvey-example.html
Created Dec 8, 2019
Kinvey Example - 12/2019
View kinvey-example.html
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<script src="kinvey-example.js"></script>
</head>
<body>
<a id='buttonLoad' href='#'>[Load]</a>
@nakov
nakov / select-replace.sql
Last active Nov 25, 2019
MySQL Find / Replace in the Database via SQL commands
View select-replace.sql
SELECT REPLACE(post_title, " ", " ") FROM wp_posts
View repl.it-code-runner.js
gitbook.events.bind("page.change", function() {
let runCodeLinks = $("p:contains('Run the above code example:') a");
for (let link of runCodeLinks) {
if (typeof(link.href) == "string" && link.href.startsWith("https://repl.it/")) {
// A repl.it link is found --> check for code box above it
let codeBox = $(link).parent().prev();
if (codeBox.is("pre")) {
// A code box is found just before the code link --> inject the [Run] button
let runButton = $("<a href='#' class='run-code-button' style='float:right'>Run</a>");
let loadingBox = $("<span class='run-code-loading' style='float:right;display:none'>Loading …</span>");
@nakov
nakov / gitbook-build.cmd
Last active Aug 1, 2019
GitBook-CLI Build & Deploy Scripts
View gitbook-build.cmd
npm install -g gitbook-cli
npm install -g serve
call gitbook install
call gitbook build . --log=debug --debug
start serve _book
start "" http://127.0.0.1:5000
pause
@nakov
nakov / AES-256-CTR-Argon2-HMAC-SHA256-example.js
Last active Jan 12, 2020
Cryptography for JavaScript Developers: Hashes, HMAC, PBKDF2, Scrypt, Argon2, AES-256-CTR, ECDSA, EdDSA, secp256k1, Ed25519
View AES-256-CTR-Argon2-HMAC-SHA256-example.js
const aes = require("aes-js");
const argon2 = require("argon2");
const crypto = require("crypto");
const cryptoJS = require("crypto-js");
// Encrypt using AES-256-CTR-Argon2-HMAC-SHA-256
async function aes256ctrEncrypt(plaintext, password) {
let argon2salt = crypto.randomBytes(16); // 128-bit salt for argon2
let argon2Settings = { type: argon2.argon2di, raw: true,
timeCost: 8, memoryCost: 2 ** 15, parallelism: 2,
@nakov
nakov / HD-wallet-create-new.js
Created Nov 4, 2018
Crypto Wallets: A Technical Perspective (Nakov at OpenFest 2018) - JavaScript Code Examples
View HD-wallet-create-new.js
let ethers = require('ethers');
let rnd256Bits = ethers.utils.randomBytes(256 / 8);
let mnemonics = ethers.HDNode.entropyToMnemonic(rnd256Bits);
let hdWallet = ethers.HDNode.fromMnemonic(mnemonics);
console.log("Wallet mnemonics:", mnemonics);
for (let index=0; index<5; index++) {
let key = hdWallet.derivePath(`m/44'/60'/0'/0/${index}'`);
console.log(`Private key #${index}: ${key.privateKey}`);
View GitHub Last Push Date Check
There is a simple way to check the last events in GitHub from certain user, including all his "git push" events:
https://api.github.com/users/{user}/events
Exmaple: https://api.github.com/users/nakov/events
You can’t perform that action at this time.