Skip to content

Instantly share code, notes, and snippets.

View dvigne's full-sized avatar

Derick Vigne dvigne

View GitHub Profile
#!/bin/bash
TICKET=$(git symbolic-ref HEAD | rev | cut -d/ -f1 | rev | grep -o -E "[A-Z]+-[0-9]+")
if [[ -n "${TICKET}" ]]; then
sed -i.bak -e "1s/^/[${TICKET}] /" $1
fi
@dvigne
dvigne / wireguard.service
Created September 6, 2022 05:58
Basic Wireguard systemd Unit File Configuration
[Unit]
Description=Wireguard VPN Server
Documentation=man:wg
After=network.target auditd.service
[Service]
ExecStartPre=/bin/bash /etc/wireguard/ifup
ExecStart=bash -c "/usr/bin/wg setconf wg0 /etc/wireguard/wg0.conf && /usr/sbin/ip link set up dev wg0"
ExecStopPost=/bin/bash /etc/wireguard/ifdown
Type=oneshot
@dvigne
dvigne / forge.config.js
Created November 14, 2021 05:10
Electron Forge Post Package Hook for Deep Signing on Mac
hooks: {
postPackage: (forgeConfig, options) => {
if (process.platform == "darwin") {
let appPath = path.resolve(options.outputPaths[0], 'CHANGEME.app');
console.log(`Signing App: ${appPath}`);
exec(`codesign --force --deep --sign - ${appPath}`,
(err, stdout, stderr) => {
if (err) {
console.log(`ERROR: ${err}`);
}
@dvigne
dvigne / CMakeLists.txt
Created October 25, 2021 16:55
Shared Library Packaging wth Cmake
project(MyLib)
cmake_minimum_required(VERSION 3.22)
include(GNUInstallDirs)
add_library(MyLib SHARED ${CMAKE_CURRENT_SOURCE_DIR}/src/MyLib.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/MyLib.hpp)
target_include_directories(MyLib PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>" "$<INSTALL_INTERFACE:include>")
install(TARGETS MyLib
EXPORT MyLibTargets
@dvigne
dvigne / animated.svg
Created October 16, 2021 05:24
Selina Animated SVG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dvigne
dvigne / index.js
Created September 22, 2021 04:44
Sbosticdesign.com JS for Carousel
<script src="https://cdnjs.cloudflare.com/ajax/libs/scrollReveal.js/4.0.9/scrollreveal.min.js" integrity="sha512-Kr+RPfLjQ71E0cJ9nseJ6jwTrnmMnuSPnnsVQQ/ZYYCjOHKfJcWj8ILICXnvf9A7ZQChNzIbr9x/ZAxA6xAZlQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js" integrity="sha512-894YE6QWD5I59HgZOGReFYm4dnWc1Qt5NtvYSaNcOP+u1T9qYdvdihz0PPSiiqn/+/3e7Jo4EaG7TubfWGUrMQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script type="text/javascript">
ScrollReveal().reveal('.reveal', { viewFactor: .75 });
ScrollReveal().reveal('.reveal-25', { viewFactor: .25 });
var imgs = [
@dvigne
dvigne / ringbuffer.hpp
Created June 18, 2021 01:41
Simple C++ Ring Buffer Object
#pragma once
#include <cstdint>
#include <exception>
#include <cmath>
struct BufferEmpty : public std::exception {
const char * what() const throw() {
return "Attempting to pop on empty buffer.";
}
};
@dvigne
dvigne / CMakeLists.txt
Created May 14, 2021 20:08
Cmake Generate Doxygen Documentation and Display Location or Open in Default Web Browser
add_custom_target(docs
COMMAND doxygen ${PROJECT_SOURCE_DIR}
COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --cyan "Generated Documentation is located at ${PROJECT_SOURCE_DIR}/doc/html/index.html"
)
add_custom_target(opendocs
COMMAND doxygen ${PROJECT_SOURCE_DIR} && xdg-open ${PROJECT_SOURCE_DIR}/doc/html/index.html
)
@dvigne
dvigne / example.service
Created April 6, 2021 18:33
Systemd Service File Template
[Unit]
Description=
#After=network.target
#BindsTo=
[Service]
Type=notify
ExecStart=PATHTOEXEC
TimeoutStartSec=3600
Restart=always
@dvigne
dvigne / CMakeLists.txt
Created March 24, 2021 20:47
Download Submodules Quietly Using CMake. Referenced From https://cliutils.gitlab.io/modern-cmake/chapters/projects/submodule.html
# Initialize Git Submodules if not already done on clone
find_package(Git QUIET)
if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
# Update submodules as needed
option(GIT_SUBMODULE "Check submodules during build" ON)
if(GIT_SUBMODULE)
message(STATUS "Submodule update")
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE GIT_SUBMOD_RESULT)