Skip to content

Instantly share code, notes, and snippets.

View M0dM's full-sized avatar

Benoit Brayer M0dM

  • Alma SCOP
  • Grenoble
  • 15:10 (UTC +02:00)
View GitHub Profile
@jasonehines
jasonehines / printer.conf
Created August 12, 2021 01:34
Ender 3 Pro Creality 4.2.7 with bltouch - Klipper printer Configuration
# This file contains pin mappings for the Creality "v4.2.7" board. To
# use this config, during "make menuconfig" select the STM32F103 with
# a "28KiB bootloader" and serial (on USART1 PA10/PA9) communication.
# If you prefer a direct serial connection, in "make menuconfig"
# select "Enable extra low-level configuration options" and select
# serial (on USART3 PB11/PB10), which is broken out on the 10 pin IDC
# cable used for the LCD module as follows:
# 3: Tx, 4: Rx, 9: GND, 10: VCC
@lucianoratamero
lucianoratamero / README.md
Last active April 22, 2025 14:17
Export Gnome settings and extensions python script

migrate_gnome_settings.py

This script makes it easier to copy Gnome settings and extensions from one pc to the other. It supports python>=3.5.

To use it, download it, then run python3 migrate_gnome_settings.py --export-settings to create a tar.gz file with all the settings.

Then, on your new system, copy the script and the gzip to your user's home directory and run python3 migrate_gnome_settings.py --import-settings.

For now, the script migrates:

@emregulcan
emregulcan / d365_webapi_authentication_by_using_OAuth_ClientCredentials.cs
Created May 1, 2019 00:37
Dynamics 365 CE (CRM) Web API Authentication by using OAuth Client Credentials Grant
public string RetrieveAuthToken(string authorityURI, string d365Url, string clientId, string clientSecret)
{
string result = string.Empty;
using (HttpClient httpClient = new HttpClient())
{
string tokenUrl = $"{authorityURI}/oauth2/token";
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, tokenUrl);
request.Content = new FormUrlEncodedContent(new[] {
@Yuyz0112
Yuyz0112 / hooks.js
Created January 17, 2019 09:53
rrweb + cypress
const sessionId = Cypress.env('sessionId');
const appFrame = window.parent.document.querySelectorAll('iframe')[0];
Cypress.on('window:load', () => {
appFrame.contentWindow.eval(`
const request = new XMLHttpRequest();
request.open('GET', 'https://cdn.jsdelivr.net/npm/[email protected]/dist/rrweb.min.js', false);
request.send('');
const script = document.createElement('script');
script.type = 'text/javascript';
@sramam
sramam / bank-account.js
Created March 17, 2018 20:56
A simple bank-account FSM, implemented in javascript-state-machine
const StateMachine = require('javascript-state-machine');
const Account = StateMachine.factory({
init: 'open',
transitions: [
// open state
{name: 'deposit', from: 'open', to: 'open'},
{name: 'withdraw', from: 'open', to: 'open'},
{name: 'available', from: 'open', to: 'open'},
@Havoc24k
Havoc24k / sync.py
Last active September 29, 2023 08:55
Import tables from one PostgreSQL database to another using the INFORMATION_SCHEMA
#!/usr/bin/python3.6
"""Sync PostgreSQL."""
import psycopg2
import sys
from psycopg2.extras import RealDictCursor, execute_values
"""
Usage:
@bradwestfall
bradwestfall / S3-Static-Sites.md
Last active October 14, 2024 15:38
Use S3 and CloudFront to host Static Single Page Apps (SPAs) with HTTPs and www-redirects. Also covers deployments.

S3 Static Sites

⚠ This post is fairly old. I don't keep it up to date. Be sure to see comments where some people have posted updates

What this will cover

  • Host a static website at S3
  • Redirect www.website.com to website.com
  • Website can be an SPA (requiring all requests to return index.html)
  • Free AWS SSL certs
  • Deployment with CDN invalidation
@dmnsgn
dmnsgn / WebGL-WebGPU-frameworks-libraries.md
Last active April 20, 2025 19:36
A collection of WebGL and WebGPU frameworks and libraries

A non-exhaustive list of WebGL and WebGPU frameworks and libraries. It is mostly for learning purposes as some of the libraries listed are wip/outdated/not maintained anymore.

Engines and libraries ⚙️

Name Stars Last Commit Description
three.js ![GitHub
@qodot
qodot / pytest_flask_fixtures.py
Created November 10, 2016 01:30
Pytest Fixtures (Flask, SQLAlchemy, Alembic)
import sys
import pytest
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from alembic.command import upgrade as alembic_upgrade
from alembic.config import Config as AlembicConfig
from wsgi import create_app
from config import config
@goldhand
goldhand / staticencoder.py
Last active May 17, 2022 21:00
Django template tag for encoding images in base64 and rendering with server
from django import template
from django.contrib.staticfiles.finders import find as find_static_file
from django.conf import settings
register = template.Library()
@register.simple_tag
def encode_static(path, encoding='base64', file_type='image'):
"""