Skip to content

Instantly share code, notes, and snippets.

@gnaggnoyil
gnaggnoyil / ngrok-selfhosting-setup.md
Created June 22, 2019 20:00 — forked from lyoshenka/ngrok-selfhosting-setup.md
How to setup Ngrok with a self-signed SSL cert

Intro

The plan is to create a pair of executables (ngrok and ngrokd) that are connected with a self-signed SSL cert. Since the client and server executables are paired, you won't be able to use any other ngrok to connect to this ngrokd, and vice versa.

DNS

Add two DNS records: one for the base domain and one for the wildcard domain. For example, if your base domain is domain.com, you'll need a record for that and for *.domain.com.

Different Operating Systems

@gnaggnoyil
gnaggnoyil / specification.md
Created October 14, 2018 07:46 — forked from rain-1/dcs.rkt
Dotted Canonical S-expressions - DCSexps

Dotted Canonical S-expressions - DCSexps

This is a specification for an s-expression interchange format that attempts to improve upon [2]rivest's canonical s-expressions.

It is an output format for a subset of s-expressions. Those containing only pairs and atoms.

It was designed with the following desirable properties in mind:

  • It has the canonicity property that (EQUAL? A B) implies the DCS output of A is byte equal to the DCS output of B.
  • It has the non-escaping property that arbitrary binary blobs can be contained as atoms without any processing. A consequence of this is that dcsexps can be nested easily.
@gnaggnoyil
gnaggnoyil / Printf.idr
Created August 8, 2018 13:52 — forked from chrisdone/Printf.idr
Type-safe dependently-typed printf in Idris
module Printf
%default total
-- Formatting AST.
data Format
= FInt Format
| FString Format
| FOther Char Format
| FEnd

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft

@gnaggnoyil
gnaggnoyil / .gitconfig
Created June 7, 2018 02:36 — forked from shawndumas/.gitconfig
Using WinMerge as the git Diff/Merge Tool on Windows 64bit
[mergetool]
prompt = false
keepBackup = false
keepTemporaries = false
[merge]
tool = winmerge
[mergetool "winmerge"]
name = WinMerge
@gnaggnoyil
gnaggnoyil / coretemp.ini
Last active June 22, 2018 00:43
Rainmeter CPU temperature widget skin for i7-8700K
[Rainmeter]
Update=1000
Background=#@#Background.png
BackgroundMode=3
BackgroundMargins=0,34,0,14
[Metadata]
Name=CPU Temperature
Author=gnaggnoyil
Information=Display CPU Temperature
@gnaggnoyil
gnaggnoyil / SMBDIS.ASM
Created January 23, 2018 03:43 — forked from 1wErt3r/SMBDIS.ASM
A Comprehensive Super Mario Bros. Disassembly
;SMBDIS.ASM - A COMPREHENSIVE SUPER MARIO BROS. DISASSEMBLY
;by doppelganger ([email protected])
;This file is provided for your own use as-is. It will require the character rom data
;and an iNES file header to get it to work.
;There are so many people I have to thank for this, that taking all the credit for
;myself would be an unforgivable act of arrogance. Without their help this would
;probably not be possible. So I thank all the peeps in the nesdev scene whose insight into
;the 6502 and the NES helped me learn how it works (you guys know who you are, there's no
@gnaggnoyil
gnaggnoyil / make_overload.hpp
Last active October 28, 2017 04:16
C++11 conforming implementation of make_overload
/*
author: gnaggnoyil(gnagnoyil at gmail.com)
license: WTFPL
*/
#include <type_traits>
#include <utility>
#include <functional>
#define NAMESPACE_STD_BEGIN namespace utility{
#define NAMESPACE_STD_END }
@gnaggnoyil
gnaggnoyil / optional.hpp
Last active February 6, 2018 03:05
An optional implementation in C++11/C++14 that tries to meet C++17 std::optional requirements
/*
author: gnaggnoyil(gnagnoyil at gmail.com)
license: WTFPL
*/
#ifndef _OPTIONAL_HPP_
#define _OPTIONAL_HPP_
#ifdef _MSC_VER
#if _MSC_VER >= 1900
#define CXX11_CONSTEXPR constexpr
@gnaggnoyil
gnaggnoyil / winproductkey.py
Created February 2, 2017 10:50
Windows Product Key
# python3 required
# tested on Windows 7 & Windows 10
import winreg
try:
key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\Microsoft\Windows NT\CurrentVersion")
value = winreg.QueryValueEx(key, "DigitalProductId")
except OSError:
print(r"""Cannot find value "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId".""")