Skip to content

Instantly share code, notes, and snippets.

View haxscramper's full-sized avatar

haxscramper haxscramper

View GitHub Profile
@haxscramper
haxscramper / Surfingkeys_settings.js
Created March 19, 2018 08:44
Setting for surfingkeys chrome extension
var remapArray =
[
[';', 'R'], // One tab right
['l', 'E'], //One tab left
[',', 'S'], //History back
['t', 'on'], // New Tab
['z', 'X'], // Restore closed tab
['.', 'D'], // History forward
['<', '<<'], // Move tab left
['>', '>>'], // Move tab right
@haxscramper
haxscramper / cpp_operator_overloading.cpp
Created June 25, 2018 17:11
C++ operator overloading.
#include <string>
#include <iostream>
struct Test {
std::string word;
Test& operator()() { return *this; }
std::string operator()(float f) { return word; }
Test& operator[](std::string w) {
word.append(w);
return *this;
ColumnLimit: 75
IndentWidth: 4
AlignAfterOpenBracket: AlwaysBreak
AlignConsecutiveAssignments: 'true'
AllowAllParametersOfDeclarationOnNextLine: 'true'
Cpp11BracedListStyle: 'true'
IndentWrappedFunctionNames: 'true'
IndentPPDirectives: AfterHash
KeepEmptyLinesAtTheStartOfBlocks: 'false'
SpacesInParentheses: 'false'
@haxscramper
haxscramper / init.vim
Created February 2, 2019 13:04
My vim config
set autowrite
set ignorecase
set incsearch
set mouse=a
set nocompatible
set number
set showcmd
set showmatch
set showmode
set smartcase
@haxscramper
haxscramper / linux_setup.md
Last active February 2, 2019 15:19
How to build qt + graphicsmagick + boost on windows/linux
  • Install qt

To build on debian you need to execute

sudo apt-get install qt5-default git curl make g++ libboost-dev libgraphicsmagick-dev graphicsmagick-libmagick-dev-compat
qmake with-magick.pro
make
@haxscramper
haxscramper / create_usb_gadget.sh
Created May 4, 2019 10:45
Log files for stack exchange question
err_file=$HOME/usb_setup_err
echo "Time: $(date -Ins)" >> $err_file
echo 'Running setup script' >> $err_file
{
##= Create usb gadget
cd /sys/kernel/config/usb_gadget/
mkdir -p hax_usb
@haxscramper
haxscramper / ast_to_dot.nim
Last active August 14, 2019 12:56
Generate graphivs graph of nim ast
import macros, tables, strformat, strutils, sequtils
import strutils
proc truncate(value: string, length = 9, ellipsis = "..."): string =
if value.len > length:
value[0..length - 1] & ellipsis
else:
value
@haxscramper
haxscramper / qucsdigi.sh
Created March 26, 2020 14:54
Use `ghdl` instead of `freehdl` in the qucs digital simulation
#! /bin/sh
#
# qucsdigi - wrapper script for digital simulation
#
# Copyright (C) 2005 Michael Margraf <michael.margraf@alumni.tu-berlin.de>
# Copyright (C) 2005, 2006, 2008, 2009 Stefan Jahn <stefan@lkcc.org>
# Copyright (C) 2005 Raimund Jacob <raimi@lkcc.org>
#
# This is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@haxscramper
haxscramper / compiler_parser.nim
Created August 2, 2020 13:01
Parse nim code at runtime
import times, stats
import compiler/[parser, llstream, idents, options, pathutils, astalgo]
var pars: TParser
let cache: IdentCache = newIdentCache()
let config: ConfigRef = newConfigRef()
var parseTime: RunningStat
@haxscramper
haxscramper / identifier_stats.nim
Created August 6, 2020 14:13
Get stats for used identifier styles in nim source code
import times, stats, strformat, os, strutils
import compiler/[parser, llstream, idents, options, pathutils, astalgo, ast]
var pars: TParser
let cache: IdentCache = newIdentCache()
let config: ConfigRef = newConfigRef()
proc parsefile(file: string): PNode =
openParser(