Skip to content

Instantly share code, notes, and snippets.

View gabriel-lopez's full-sized avatar
🎯
Focusing

Gabriel Lopez gabriel-lopez

🎯
Focusing
View GitHub Profile

YubiKey SSH Signing Key Setup

1. Generate the FIDO2 resident key on the YubiKey

ssh-keygen -t ed25519-sk -O resident -O application=ssh:<your-username>-signing -O user=<your-username> -C "<your-email>" -f "$env:USERPROFILE\.ssh\id_ed25519_sk_<your-username>-signing"

Key flags:

  • -t ed25519-sk — hardware-backed FIDO2 key

GitHub Authentication via SSH using a YubiKey

1. Generate a resident authentication key

A separate key from the signing one — same process, different application name:

ssh-keygen -t ed25519-sk -O resident -O application=ssh:<your-username>-auth -O user=<your-username> -C "<your-email>" -f "$env:USERPROFILE\.ssh\id_ed25519_sk_<your-username>-auth"
; Ender 3 Custom Start G-code
M140 S{material_bed_temperature_layer_0} ; Set Heat Bed temperature
M190 S{material_bed_temperature_layer_0} ; Wait for Heat Bed temperature
M104 S160; start warming extruder to 160
G28 ; Home all axes
G29 ; Auto bed-level (BL-Touch)
G92 E0 ; Reset Extruder
M104 S{material_print_temperature_layer_0} ; Set Extruder temperature
G1 X0.1 Y20 Z0.3 F5000.0 ; Move to start position
M109 S{material_print_temperature_layer_0} ; Wait for Extruder temperature
@gabriel-lopez
gabriel-lopez / SpecialFolder.cs
Created July 9, 2020 10:45
Utility class used to get the path of special known folders.
using System;
using System.Runtime.InteropServices;
public static class SpecialFolder
{
[DllImport("shell32.dll")]
private static extern int SHGetKnownFolderPath([MarshalAs(UnmanagedType.LPStruct)] Guid rfid, uint dwFlags, IntPtr hToken, out IntPtr pszPath);
public static string GetPath(Guid knownFolderId)
{
@gabriel-lopez
gabriel-lopez / TempFolder.cs
Created March 29, 2020 12:43
Utility class used to get a temporary folder path.
public sealed class TempFolder
{
public string Path { get; }
public TempFolder()
{
string guid = Guid.NewGuid().ToString();
string tempPath = System.IO.Path.GetTempPath();
string path = System.IO.Path.Combine(tempPath, guid);
@gabriel-lopez
gabriel-lopez / set-datetime.ps1
Created March 24, 2020 19:27
Update computer time using worldtimeapi.org API
# Ensures that Invoke-WebRequest uses TLS 1.2
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$json = Invoke-WebRequest 'http://worldtimeapi.org/api/timezone/Europe/Zurich' | ConvertFrom-Json
set-date -date $json.datetime
@gabriel-lopez
gabriel-lopez / LinkProtectorBypass.cs
Created December 14, 2019 21:03
Link Protector (protect-link.me) Bypass
using System;
using System.Collections.Generic;
using System.Net.Http;
using HtmlAgilityPack;
public sealed class LinkProtectorBypass
{
private const string URL = "https://protect-link.me/";
private const string USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36";
@gabriel-lopez
gabriel-lopez / VLCHelper.cs
Created July 13, 2018 11:19
Utility class used to detect the location of VLC and launch a stream.
public static class VLCHelper
{
private const string KEY = @"SOFTWARE\VideoLAN\VLC";
public static void StartStream(string url)
{
string path = null;
// Checking 32-Bit VLC Install
RegistryKey localKey32 = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32);
@gabriel-lopez
gabriel-lopez / movie.js
Created May 2, 2018 05:54
ProgCli - Examen M45
// Aide pour les URL des Web Services
var WS = "https://chabloz.eu/movies/";
var WS_THUMB = "https://chabloz.eu/movies/thumb/?id=";
var WS_RATING = "https://chabloz.eu/movies/rating/get/";
var WS_RATEIT = "https://chabloz.eu/movies/rating/post/";
// Aide: pour arrondir un nombre à l'entier le plus proche: Math.round(nb_ici);
// Variables globales
var templateMovie;
@gabriel-lopez
gabriel-lopez / search.js
Created January 20, 2018 11:50
ProgCli - Examen M44
var WS_GOOGLE_BOOKS = "https://www.googleapis.com/books/v1/volumes?key=AIzaSyCqXyRFYjzkJIsQpTCpz7hSnjqJ0XZ49eQ"; // &q=algorithme
// WS DE SECOURS
var WS_GOOGLE_BOOKS_STATIC = "http://chabloz.eu/m44/books/"
var WS_YOUTUBE = "https://www.googleapis.com/youtube/v3/search?part=snippet&type=video&videoEmbeddable=true&key=AIzaSyCqXyRFYjzkJIsQpTCpz7hSnjqJ0XZ49eQ"; // &q=algorithme
// WS DE SECOURS
var WS_YOUTUBE_STATIC = "http://chabloz.eu/m44/videos/"; // &q=algorithme
// Variables globales
var templateBook;