Skip to content

Instantly share code, notes, and snippets.

brew install qt
brew linkapps qt
brew cask install qt-creator
launchctl setenv QTDIR /usr/local/Cellar/qt/4.8.7_2 (your env)
@jclosure
jclosure / .nanorc
Created October 5, 2016 17:12
Nano configuration file with C++ syntax highlighting
# turn on auto-indent
set autoindent
# syntax highlighting for C and C++
syntax "C" ".*(h|c)(xx|pp)?|cc"
# first color the whole include line magenta...
color brightmagenta "^\s*#include\s*["<].*[">]"
# then make the include (or any other preprocessor directive) itself blue
color brightblue "^\s*#((include\s*)|((define\b|ifdef\b|else\b|endif\b|ifndef\b|if\b|else\b|elif\b|line\b|error\b|pragma\b|undef\b).*))"
# types and type qualifiers are green
@jclosure
jclosure / gist:9a5910b3ea57636db96578fd5e396508
Created October 6, 2016 01:45
tracing functions with message logging in elisp
;; debugging - ensure that message-show-backtrace's arg count matches that of the function to trace
(defun message-show-backtrace ()
(message "%s-->%s" "MESSAGE HERE" (or (backtrace-frame 10)
"NO BACKTRACE")))
;; set name of function to trace - e.g. 'ztl-modification-state-change
(setq traced-function 'ztl-modification-state-change)
;;;; eval to enable
;;(advice-add traced-function' :before #'message-show-backtrace)
@jclosure
jclosure / install_global.sh
Last active August 12, 2017 03:46
gnu global - How to install GNU Global 6.x on Ubuntu 14.04
#!/bin/bash
# install_global.sh
echo "install_global.sh ...."
echo "install package for GNU global..."
sudo apt-get update
sudo apt-get -y install curl
sudo apt-get -y install wget
sudo apt-get -y install ncurses-dev
@jclosure
jclosure / osx_random_password_in_shell
Created November 12, 2016 08:51
Random password generator in shell for OSX
brew install pwgen
genpasswd() {
pwgen -Bsy $1 1 | pbcopy
_tmp=`pbpaste`
echo $_tmp
echo "Has been copied to clipboard"
}
@jclosure
jclosure / ITerm2_W_My_Arrow_Nav
Created November 16, 2016 17:52
ITerm2 Profile with option <-/-> word skip and windmove style pane navigation
{
"Ansi 7 Color" : {
"Green Component" : 0.7333333492279053,
"Blue Component" : 0.7333333492279053,
"Red Component" : 0.7333333492279053
},
"Tags" : [
],
"Ansi 12 Color" : {
@jclosure
jclosure / gist:86927db229cf0cc66d7d8b564f9be891
Created November 21, 2016 05:10
Ways of getting current method name and module in Elixir
def callee do
try do
raise("fake")
rescue
e in RuntimeError ->
[_, {m, f, a, _} | _] = :erlang.get_stacktrace()
:io.format("I am ~p:~p/~p!~n",[m, f, a])
{m, f, a}
end
end
@jclosure
jclosure / ubuntu_desktop_install_routine.sh
Created November 26, 2016 16:53
Debian/Ubuntu Desktop Install Packages Script
#!/bin/bash
sudo apt-get update
sudo apt-get install build-essential -y
sudo apt-get install curl -y
sudo apt-get install wget -y
sudo apt-get install ncurses-dev -y
sudo apt-get install llvm -y
sudo apt-get install clang -y
@jclosure
jclosure / octree_splitting.cpp
Created November 27, 2016 03:50
Octree splitting
// Example program
#include <iostream>
#include <string>
int main()
{
for(int i=0; i<8; ++i) {
float x = 1.0f * (i&4 ? .5f : -.5f);
float y = 1.0f * (i&2 ? .5f : -.5f);
float z = 1.0f * (i&1 ? .5f : -.5f);
@jclosure
jclosure / get_octant_intersection.cpp
Created November 27, 2016 04:44
See if which octant intesects a random point
// Example program
#include <iostream>
#include <string>
#include <cmath>
struct Vec3;
Vec3 operator*(float r, const Vec3& v);
struct Vec3 {