Skip to content

Instantly share code, notes, and snippets.

View d3v-null's full-sized avatar

Dev Null d3v-null

View GitHub Profile
#include <string>
#include <map>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
// #include <pair>
using namespace std;
class ETNode {
public:
char value;
ETNode *left, *right;
ETNode(char value_);
ETNode(char value_, ETNode* left_, ETNode* right_);
};
// A very simple expression tree class that converts a parenthesized input
// consisting of addition and multiplication operations, into an expression tree.
input[ 0 ] = '2'
st = [ ]
t = { 'value': '2' }
input[ 1 ] = '+'
st = [
{ 'value': '2' } ]
t = { 'value': '+' }
input[ 2 ] = '('
#include "Expression_Tree.h"
#include <iostream>
#include <stack>
#include <string>
#include <iomanip>
using namespace std;
bool isDigit(char ch) {
return (ch >='0' && ch <= '9');
}
@d3v-null
d3v-null / 0_reuse_code.js
Last active June 1, 2017 01:03
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@d3v-null
d3v-null / 1_notmnist_derwent.ipynb
Created June 22, 2017 02:02
My solutions to the Udacity Tensor Flow Assignment 1
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@d3v-null
d3v-null / .htaccess
Last active June 27, 2017 04:23
Here's how to fix 404s caused by disabling qTranslatex plugin. Change en|fr to a list of | separated language codes.
# BEGIN Derwent qTranslatex mods
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^(en|fr)(/.*|)$ $2 [L,NC,R=301]
</IfModule>
# END Derwent qTranslatex mods
#!/usr/bin/env python
from __future__ import print_function
import sys
import time
import re
# import pyuarm
import yaml
from pprint import pformat
@d3v-null
d3v-null / pprint_pyperclip.py
Created December 7, 2017 22:49
My "one-liner" macro for pformatting and inserting it into the clipboard for analysis. I'd suggest using a snippet manager which supports cursor insertion (like Dash) to avoid having to scroll backwards to replace the @cursor placeholder. I have this mapped to ;ppc
import pyperclip, pprint; pyperclip.copy( pprint.pformat( @cursor ) )
@d3v-null
d3v-null / pprint_color.py
Last active December 7, 2017 23:01 — forked from EdwardBetts/pprint_color.py
My "one-liner" macro for pformatting an object with colour. I'd suggest using a snippet manager which supports cursor insertion (like Dash) to avoid having to scroll backwards to replace the @cursor placeholder. I have this mapped to ;cpp
from pygments import highlight; from pygments.lexers import PythonLexer; from pygments.formatters import Terminal256Formatter; from pprint import pformat; print(highlight(pformat( @cursor ), PythonLexer(), Terminal256Formatter()))