Skip to content

Instantly share code, notes, and snippets.

View apetenchea's full-sized avatar

Alex Petenchea apetenchea

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
// Example of a constant being modified
// clang++ -Wall -std=c++17 -O2 -o modify_const modify_const.cpp
#include <iostream>
#include <string>
#include <sstream>
unsigned long long hex_to_dec(std::string str)
{
unsigned long long result = 0;
@apetenchea
apetenchea / permissions.sh
Created July 8, 2022 11:20
CLion remote editing fix
#!/bin/bash
# Fix file permissions after setting up remote development with CLion
# Run this in the root of your project folder
dir=$(pwd)
for f in $(rg -l "\#!")
do
echo "$f"
cd $(dirname "$f")
# My own Dockerfile for building arangodb using gcc-11.2
# docker run -it -v /local/path/to/arangodb:/arangodb gcc-11.2 /bin/bash
FROM gcc:11.2.0
WORKDIR /arangodb
RUN apt-get -y update && apt-get install -y build-essential libssl-dev libjemalloc-dev python libldap2-dev ripgrep
RUN wget https://github.com/Kitware/CMake/releases/download/v3.23.3/cmake-3.23.3-Linux-x86_64.sh \
-q -O /tmp/cmake-install.sh \
&& chmod u+x /tmp/cmake-install.sh \
&& mkdir /usr/bin/cmake \
#!/bin/bash
# create build directory
mkdir -p build
# run cmake
(cd build && cmake \
-DCMAKE_CXX_COMPILER="clang++" \
-DCMAKE_C_COMPILER="clang" \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
@apetenchea
apetenchea / dumpall.sh
Created March 28, 2023 16:23
Generate core dumps for all arangod processes
#!/bin/bash
if [ $# -eq 0 ]; then
proc="$(ps aux | grep arangod | grep -v grep)"
else
proc="$(ps aux | grep arangod | grep -v grep | grep $1)"
fi
echo "$proc" > ps.txt
@apetenchea
apetenchea / mealplan.py
Created April 28, 2023 17:55
Mealplan parser
# Script for parsing mealplans and generating a shopping list
# python mealplan.py mealplan.txt > list.txt
import sys
import re
def get_lines(file):
names = ['Alex', 'Lucia']