Skip to content

Instantly share code, notes, and snippets.

View jmcker's full-sized avatar

Jack McKernan jmcker

View GitHub Profile
@kmantel
kmantel / add_wterm.bat
Created June 17, 2020 08:22
Creates a context menu shortcut for launching Windows Terminal in the current directory from explorer
@echo off
echo You must add "startingDirectory": "." to your Windows Terminal profile ^
settings or this will not work.
echo(
set winterm_path="\"%LocalAppData%\Microsoft\WindowsApps\wt.exe\""
reg add HKCR\Directory\Background\shell\winterm\command
reg add HKCR\Directory\Background\shell\winterm\command /ve /t REG_EXPAND_SZ /d %winterm_path%
reg add HKCR\Directory\Background\shell\winterm\ /ve /t REG_EXPAND_SZ /d "Open Windows Terminal here"
@superseb
superseb / cleanup.sh
Last active August 13, 2024 07:31
Cleanup host added as custom to Rancher 2.0
#!/bin/sh
# OUTDATED: please refer to the link below for the latest version:
# https://github.com/rancherlabs/support-tools/blob/master/extended-rancher-2-cleanup/extended-cleanup-rancher2.sh
docker rm -f $(docker ps -qa)
docker volume rm $(docker volume ls -q)
cleanupdirs="/var/lib/etcd /etc/kubernetes /etc/cni /opt/cni /var/lib/cni /var/run/calico /opt/rke"
for dir in $cleanupdirs; do
echo "Removing $dir"
rm -rf $dir
done
@jarek-foksa
jarek-foksa / index.html
Last active July 7, 2020 13:42 — forked from SMotaal/README.md
Electron 2.x demo app that demonstrates how to enable ES modules support.
<!DOCTYPE html>
<html>
<head>
<base href="app://./" />
<meta http-equiv="Content-Security-Policy" content="script-src 'self' app:; object-src 'self' app:;">
<script type="module" src="./module.js"></script>
</head>
<body>
Check the console!
@SMotaal
SMotaal / README.md
Last active January 13, 2023 20:07
Loading ES Modules in Electron 2.0.0 using Protocol

Now that Electron has hit Chrome's 60s we can have proper module support. But of course, the standard (for very good reasons) prevents loading modules from file: and it makes sense for both Electron and NW.js to adhere to the statusquo.

So if you were really excited and this bums you, don't worry, you are in for awesome things.

The future Electron eco-system offers two options for native ES modules:

  1. Custom Electron protocol via Chromium's module loading subsystem

  2. Custom NodeJS loaders via Node's module loading subsystem recommended

@sudo-bmitch
sudo-bmitch / console-log.md
Created February 22, 2018 14:04
How inodes work in containers when you tail a file

Docker filesystem layers can be tricky to wrap your head around, and even more so how indoes work. Lets take an example and see what happens when you tail a file that exists in the image as part of your container entrypoint:

host$ docker run -d --rm --name test-inode debian tail -f /etc/issue                              
54bbfa8fa1f6751593dcf23103a1cdaec7fde8ffbcb3e31bab466b4f7a3581e7

Now make some changes to the file:

@mbinna
mbinna / effective_modern_cmake.md
Last active April 17, 2025 03:18
Effective Modern CMake

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft

@giraldeau
giraldeau / CMakeLists.txt
Created November 3, 2017 21:48
The missing example to use cmake qt5_create_translation
cmake_minimum_required(VERSION 3.8)
project(tsProject)
# Managing translations require LinguistTools module
# The cmake function is defined in the Qt installation tree:
# i.e. Qt5.9.1/5.9.1/gcc_64/lib/cmake/Qt5LinguistTools/Qt5LinguistToolsMacros.cmake
# Reference: https://doc.qt.io/qt-5/cmake-manual.html#qt5linguisttools-macros
find_package(Qt5 COMPONENTS Widgets LinguistTools)
set (CMAKE_CXX_STANDARD 11)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
@galli-leo
galli-leo / tmdbdump.py
Last active November 22, 2024 22:17
Dumping the entire TMDB database's json inside a directory. Usage: python3 tmdbdump.py START_ID (defaults to 1)
import requests
import time
import json
import sys
import threading
import queue
from datetime import timedelta
API_KEY = "YOUR_TMDB_APIKEY"
append_to_response = "images,alternative_titles,videos,credits,keywords,release_dates,similar_movies,recommendations" //Change this if you do not want all the data.
@copperlight
copperlight / .bashrc
Created August 11, 2016 16:27
Window Subsystem for Linux ssh-agent Configuraton
# ... more above ...
# wsfl bash is not a login shell
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
# ssh-agent configuration
if [ -z "$(pgrep ssh-agent)" ]; then
rm -rf /tmp/ssh-*