Skip to content

Instantly share code, notes, and snippets.

#include <iostream>
const float GAIN(1.5);
void
multiply(float *f)
{
(*f) *= GAIN;
}
#include <iostream>
int main()
{
float f(32767); // 32768
signed short sshf = static_cast<signed short>(f);
signed short rshf = *(reinterpret_cast<signed short*>(&f));
std::cout << "As float: "
<< f << " (" << sizeof(float) << ")\n"
(add-to-list 'electric-layout-rules '(123 . before))
@orontee
orontee / lexarith.py
Last active December 27, 2015 14:09
Arithmetic expressions lexer and parser
import argparse
import operator
sym_tokens = {'unary_operators': (r'+', r'-'),
'binary_operators': (r'+', r'-', r'*', r'/'),
'grouping_open': (r'(',),
'grouping_close': (r')',)}
semantic = {'binary_operators': {r'+': operator.add,
r'-': operator.sub,
;;; mule-cmds.el --- commands for multilingual environment -*-coding: iso-2022-7bit -*-
;; Copyright (C) 1997-2013 Free Software Foundation, Inc.
;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
;; 2005, 2006, 2007, 2008, 2009, 2010, 2011
;; National Institute of Advanced Industrial Science and Technology (AIST)
;; Registration Number H14PRO021
;; Copyright (C) 2003
;; National Institute of Advanced Industrial Science and Technology (AIST)
;; Registration Number H13PRO009
@orontee
orontee / machine-desc_light.json
Created October 26, 2017 12:13
Packer log and files for amazon-ebsvolume failure
{
"description": "Sample for debug",
"variables": {
"aws_access_key": "{{env `AWS_ACCESS_KEY_ID`}}",
"aws_secret_key": "{{env `AWS_SECRET_ACCESS_KEY`}}",
"region": "eu-west-1"
},
"builders": [
{
"type": "amazon-ebsvolume",