Skip to content

Instantly share code, notes, and snippets.

@christophercrouzet
christophercrouzet / distance.h
Last active April 16, 2024 13:02
Compute the distance in ulps between floating-point numbers in C++11.
#ifndef DISTANCE_H
#define DISTANCE_H
#include <algorithm>
#include <cassert>
#include <cmath>
#include <limits>
#include "floatingpointtraits.h"
@Ryanb58
Ryanb58 / install.md
Last active April 16, 2024 13:02
How to install telnet into a alpine docker container. This is useful when using the celery remote debugger in a dev environment.
>>> docker exec -it CONTAINERID /bin/sh
/app # telnet
/bin/sh: telnet: not found

/app # apk update
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz
v3.7.0-243-gf26e75a186 [http://dl-cdn.alpinelinux.org/alpine/v3.7/main]
v3.7.0-229-g087f28e29d [http://dl-cdn.alpinelinux.org/alpine/v3.7/community]
@tanaikech
tanaikech / submit.md
Last active April 16, 2024 13:00
Consolidate Scattered A1Notations into Continuous Ranges on Google Spreadsheet using Google Apps Script

Consolidate Scattered A1Notations into Continuous Ranges on Google Spreadsheet using Google Apps Script

Abstract

Consolidate scattered cell references (A1Notation) in Google Sheets for efficiency. This script helps select cells by background color or update values/formats, overcoming limitations of large range lists.

Introduction

@msguner
msguner / json_replace_placeholders.py
Created December 26, 2019 07:46
Python replace placeholders in json
import re
def replace_json_placeholders(json, values):
# find all placeholders
placeholders = re.findall('<[\w ]+>', json)
# clear_placeholders = list(map(lambda x: x.replace('<', '').replace('>', ''), placeholders))
assert len(placeholders) == len(values), "Please enter the values of all placeholders."
# replaces all placeholders with values
@nir9
nir9 / server.c
Created November 25, 2023 16:50
Minimalist C Web Server - not for production use, only for fun :)
#include <sys/socket.h>
#include <string.h>
#include <fcntl.h>
#include <sys/sendfile.h>
#include <unistd.h>
#include <netinet/in.h>
void main() {
int s = socket(AF_INET, SOCK_STREAM, 0);
struct sockaddr_in addr = {
@hayajo
hayajo / changelog_en.md
Last active April 16, 2024 12:57
ChangeLog を支える英語

ChangeLog を支える英語

ChangeLog を書く際によく使われる英語をまとめました。

ほとんど引用です。

基本形

@RubenKelevra
RubenKelevra / fast_firefox.md
Last active April 16, 2024 12:56
Make Firefox fast again
@rjescobar
rjescobar / extend-trial-jetbrains-windows.bat
Created August 31, 2021 02:53
JetBrains IDE trial reset windows
REM Delete eval folder with licence key and options.xml which contains a reference to it
for %%I in ("WebStorm", "IntelliJ", "CLion", "Rider", "GoLand", "PhpStorm", "Resharper", "PyCharm") do (
for /d %%a in ("%USERPROFILE%\.%%I*") do (
rd /s /q "%%a/config/eval"
del /q "%%a\config\options\other.xml"
)
)
REM Delete registry key and jetbrains folder (not sure if needet but however)
rmdir /s /q "%APPDATA%\JetBrains"
@sjgallagher2
sjgallagher2 / basic-embedded-c.c
Last active April 16, 2024 12:54
A get-started-fast guide to embedded C
/*
* In embedded systems, the C programming language is most often the language of choice. For more intensive
* elements in the system, assembly can be used. Embedded C is distinct from typical C programming in its
* requirements for efficiency, its limited resources, and its unique hardware problems which are much less common in
* the majority of C programs. Even still, the language itself is the same, so check out K&R's The C Programming
* Language and other reference books.
*
* Some of the problems central to embedded systems programming:
* - Memory management
* - Register access and manipulation
@Blackshome
Blackshome / sensor-light.yaml
Last active April 16, 2024 12:53
Home Assistant Sensor Light that can be used in Blueprints
blueprint:
name: Sensor Light
description: >
# 💡 Sensor Light
**Version: 6.5**
Your lighting experience, your way - take control and customize it to perfection! 💡✨