Skip to content

Instantly share code, notes, and snippets.

View Belphemur's full-sized avatar

Antoine Aflalo Belphemur

View GitHub Profile
@kevin-david
kevin-david / airgradient-02.yaml
Last active November 12, 2023 18:25
AirGradient DIY: ESPHome with Sleep (extend PM2.5 sensor lifetime)
##
## See https://github.com/kevin-david/home-assistant-shared/blob/main/esphome/airgradient.yml for future updates
##
substitutions:
name: airgradient-02
### Everything below this can be copy/paste between similar devices
esphome:
name: $name
@shayne
shayne / !Tailscale Unraid Setup.bash
Last active June 9, 2023 16:02
Tailscale Unraid Setup
########################################################################
#### DEPRECATED in favor of https://github.com/deasmi/unraid-tailscale
########################################################################
# /boot/config/go
# add the following...
# Tailscale
bash /boot/config/tailscale/install.sh
@munificent
munificent / generate.c
Last active March 18, 2024 08:31
A random dungeon generator that fits on a business card
#include <time.h> // Robert Nystrom
#include <stdio.h> // @munificentbob
#include <stdlib.h> // for Ginny
#define r return // 2008-2019
#define l(a, b, c, d) for (i y=a;y\
<b; y++) for (int x = c; x < d; x++)
typedef int i;const i H=40;const i W
=80;i m[40][80];i g(i x){r rand()%x;
}void cave(i s){i w=g(10)+5;i h=g(6)
+3;i t=g(W-w-2)+1;i u=g(H-h-2)+1;l(u
@SanderTheDragon
SanderTheDragon / postman-deb.sh
Last active April 3, 2024 05:30
A shellscript to create a Postman .deb file, for simple installation on Debian-based Linux distro's. Also creates a .desktop file.
#!/bin/sh
# SPDX-FileCopyrightText: 2017-2022 SanderTheDragon <sanderthedragon@zoho.com>
#
# SPDX-License-Identifier: MIT
curlExists=$(command -v curl)
echo "Testing Postman version"
@mrluanma
mrluanma / api.example.net.conf
Created September 9, 2014 08:27
cache POST request with Nginx
upstream api_example_net {
server api.example.net:4000;
keepalive 600;
}
proxy_cache_path /var/cache/nginx/tag levels=1:2 keys_zone=tag:10m inactive=1d max_size=10g;
server {
listen 80;
server_name api.example.net;
@muffycompo
muffycompo / base64_url_safe.php
Created July 10, 2014 23:05
PHP Helper functions for Safe Base64 URL encode
<?php
function base64url_encode($data) {
return rtrim(strtr(base64_encode($data), '+/', '-_'), '=');
}
function base64url_decode($data) {
return base64_decode(str_pad(strtr($data, '-_', '+/'), strlen($data) % 4, '=', STR_PAD_RIGHT));
}
?>
@kyleturner
kyleturner / Remove Submodule
Created January 5, 2012 01:07
How to remove a submodule from a Github project
To remove a submodule you need to:
Delete the relevant line from the .gitmodules file.
Delete the relevant section from .git/config.
Run git rm --cached path_to_submodule (no trailing slash).
Commit and delete the now untracked submodule files.
@zsimic
zsimic / DefaultKeyBinding.dict
Last active April 17, 2024 13:27
OSX key bindings
{
/* ~/Library/KeyBindings/DefaultKeyBinding.dict
See https://gist.github.com/zsimic/1367779, prefix cheatsheet:
Char Short Key
$ S- Shift ⇧
^ C- CTRL ⌃
~ O- Option ⌥ (⊞ Win key position on PC)
@ M- Command ⌘ (Alt position on PC)
# Numeric Keypad