Skip to content

Instantly share code, notes, and snippets.

View dendisuhubdy's full-sized avatar
🚀
at the speed of light

Dendi Suhubdy dendisuhubdy

🚀
at the speed of light
View GitHub Profile
@dendisuhubdy
dendisuhubdy / orthodoxc++.md
Created November 6, 2019 15:18 — forked from bkaradzic/orthodoxc++.md
Orthodox C++

Orthodox C++

What is Orthodox C++?

Orthodox C++ (sometimes referred as C+) is minimal subset of C++ that improves C, but avoids all unnecessary things from so called Modern C++. It's exactly opposite of what Modern C++ suppose to be.

Why not Modern C++?

@dendisuhubdy
dendisuhubdy / endian.h
Created October 16, 2019 17:26 — forked from yinyin/endian.h
BSD/Linux-like <endian.h> for MacOS X
#ifndef __FINK_ENDIANDEV_PKG_ENDIAN_H__
#define __FINK_ENDIANDEV_PKG_ENDIAN_H__ 1
/** compatibility header for endian.h
* This is a simple compatibility shim to convert
* BSD/Linux endian macros to the Mac OS X equivalents.
* It is public domain.
* */
#ifndef __APPLE__
@dendisuhubdy
dendisuhubdy / zshrc
Created September 24, 2019 16:09 — forked from aquaductape/zshrc
# Luke's config for the Zoomer Shell
# Enable colors and change prompt:
autoload -U colors && colors
PS1="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%~%{$fg[red]%}]%{$reset_color%}$%b "
# History in cache directory:
HISTSIZE=10000
SAVEHIST=10000
HISTFILE=~/.cache/zsh/history
@dendisuhubdy
dendisuhubdy / litecoin.conf
Created September 20, 2019 10:36 — forked from dasher/litecoin.conf
example litecoin.conf
# litecoin.conf configuration file. Lines beginning with # are comments.
# Network-related settings:
# Run on the test network instead of the real litecoin network.
#testnet=0
# Connect via a socks4 proxy
#proxy=127.0.0.1:9050
@dendisuhubdy
dendisuhubdy / stt
Created September 6, 2019 09:03 — forked from tyspa1/stt
Use Google Speech API with Python using Pyaudio and flac for Windows
import pyaudio
import wave
import audioop
from collections import deque
import os
import urllib2
import urllib
import time
import math

Google Speech To Text API

Base URL: https://www.google.com/speech-api/v1/recognize
It accepts POST requests with voice file encoded in FLAC format, and query parameters for control.

Query Parameters

client
The client's name you're connecting from. For spoofing purposes, let's use chromium

lang
Speech language, for example, ar-QA for Qatari Arabic, or en-US for U.S. English

@dendisuhubdy
dendisuhubdy / GnuPG-2.1.md
Created September 5, 2019 02:35 — forked from mattrude/GnuPG-2.1.md
GnuPG 2.1.18 Build Instructions for Ubuntu 16.04 LTS

GnuPG 2.1.20 Build Instructions

Below you is my build instructions for GnuPG 2.1.20 released on 03-Apr-2017. These instructions are built for a headless Ubuntu 16.04 LTS server.

Or if you wish, you may use the install script to install GnuPG 2.1.20 by entring the following:

curl -sL "https://gist.github.com/mattrude/3883a3801613b048d45b/raw/install-gnupg2.sh" |sh

Install the needed depends

apt-get -y install libgnutls-dev bzip2 make gettext texinfo gnutls-bin \

C++'s Templates

C++'s templates could be seen as forming a duck typed, purely functional code generation program that is run at compile time. Types are not checked at the initial invocation stage, rather the template continues to expand until it is either successful, or runs into an operation that is not supported by that specific type – in that case the compiler spits out a 'stack trace' of the state of the template expansion.

To see this in action, lets look at a very simple example:

template <typename T>
T fact(T n) {
 return n == T(0) ? T(1) : fact(n - T(1)) * n;
#include <type_traits>
#include <iostream>
// Template magic to test if class has .METHOD
#define ENABLEHASMETHOD(METHOD) \
template <class T__> \
struct Has_##METHOD { \
template <class U__, class = decltype(&(U__::METHOD))> \
static const std::true_type Tester(U__*); \
\