Skip to content

Instantly share code, notes, and snippets.

View blockspacer's full-sized avatar
:octocat:

Devspace blockspacer

:octocat:
  • Google
  • USA
View GitHub Profile
#include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/phoenix.hpp>
#include <iomanip>
#include <llvm/ADT/APInt.h>
#include <llvm/ADT/SmallString.h>
namespace qi = boost::spirit::qi;
template <typename It>
struct IntLiteral : qi::grammar<It, llvm::APInt()> {
@blockspacer
blockspacer / 1_VcXsrv.md
Last active January 17, 2024 17:32
Install WSL2 & VcXsrv & systemd & plasma KDE & snap
Install Windows Terminal https://github.com/hubisan/emacs-wsl#use-windows-terminal

Install VcXsrv https://sourceforge.net/projects/vcxsrv/

Close everything and go to Windows Firewall with Advanced Security -> Inbound rules and delete every rule you see for Vcxsvr.exe. After that the first time you launch Vcxsvr make sure you Allow access for Private AND Public networks.

Search for VcXsrv entries (there should be two) and disable all found.

# see https://github.com/microsoft/WSL/issues/6181
@blockspacer
blockspacer / MergeSimilarFolderNamesByStringDistance.ps1
Last active June 19, 2024 07:04
Powershell `unzip.ps1` - unzip all in folder. `movebetween.ps1` - move files from folder with names matching contents of other folder. `movelonedirs.ps1` - move subdirs at upper level and remove empty subdirs
[CmdletBinding()] param () # https://stackoverflow.com/a/69203862
function Measure-StringDistance {
<#
.SYNOPSIS
Compute the distance between two strings using the Levenshtein distance formula.
.DESCRIPTION
Compute the distance between two strings using the Levenshtein distance formula.
@blockspacer
blockspacer / java.library.path.md
Created February 18, 2022 10:22 — forked from andreibosco/java.library.path.md
How to add a .so to java.library.path
#include <fstream>
#include <scripting/ModException.hpp>
#include <sanity.hpp>
#include "LuaSecurity.hpp"
using namespace scripting;
namespace {
void copyAll(sol::environment &env, const sol::global_table &globals,
@blockspacer
blockspacer / run.sh
Created October 28, 2021 14:23
install cling jupyter kernel
# see https://blog.jupyter.org/interactive-workflows-for-c-with-jupyter-fe9b54227d92
# tested with python 3.8
git config --global http.sslCAInfo /etc/ssl/certs/ca-certificates.crt
pip install jupyter
# read:
# https://unix.stackexchange.com/a/442517
# https://github.com/conda/conda/issues/10431
sudo dpkg-reconfigure dash
file /bin/sh # /bin/sh must be symbolic link to bash
@blockspacer
blockspacer / main.js
Last active May 23, 2021 07:49
ue4 marketplace all all to checkout
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
var arr = $(".add-cart-btn") ;
console.log(arr);
for (var i = 0; i < arr.length; i++ ) {
var cart_amount = $(".cart-amount") ;
console.log(cart_amount[0]);
@blockspacer
blockspacer / sanitizers_llvm.bash
Last active May 21, 2021 13:26
Build llvm with sanitizers: First, build sanitized cxx cxxabi compiler-rt with LLVM_USE_SANITIZER. Next, build compiler-rt without LLVM_USE_SANITIZER but with COMPILER_RT_BUILD_SANITIZERS="ON"
export CC=clang
export CXX=clang++
rm CMakeCache.txt ; cmake ../llvm -DCMAKE_BUILD_TYPE="Release" -DBUILD_SHARED_LIBS="ON" -DCONAN_CMAKE_POSITION_INDEPENDENT_CODE="ON" -DCMAKE_VERBOSE_MAKEFILE="ON" -DLLVM_ENABLE_PROJECTS="compiler-rt;libcxx;libcxxabi" -DLLVM_PARALLEL_COMPILE_JOBS="5" -DLLVM_COMPILER_JOBS="5" -DLLVM_PARALLEL_LINK_JOBS="1" -DLLVM_USE_SANITIZER="Address;Undefined" -DLLVM_ENABLE_LIBCXX="ON" -DLLVM_TOOL_CLANG_TOOLS_EXTRA_BUILD="OFF" -DLLVM_TOOL_OPENMP_BUILD="OFF" -DCLANG_ENABLE_ARCMT="OFF" -DCLANG_ENABLE_STATIC_ANALYZER="OFF" -DCLANG_ENABLE_FORMAT="OFF" -DCLANG_TOOL_CLANG_FORMAT_BUILD="OFF" -DCLANG_TOOL_CLANG_FUZZER_BUILD="OFF" -DLLVM_BUILD_INSTRUMENTED="OFF" -DLLVM_BUILD_LLVM_DYLIB="OFF" -DLLVM_LINK_LLVM_DYLIB="OFF" -DLLVM_ENABLE_LTO="OFF" -DLLVM_ENABLE_ZLIB="ON" -DLLVM_ENABLE_FFI="OFF" -DLLVM_BUILD_TOOLS="OFF" -DLLVM_INCLUDE_TOOLS="ON" -DLLVM_USE_OPROFILE="OFF" -DCOMPILER_RT_BUILD_SANITIZERS="ON" -DCOMPILER_RT_BUILD_BUILTINS="OFF" -DCOMPILER_RT_BUILD_XRAY="ON" -DCOMPILER_RT_BUILD_XRAY_NO_PRE