Skip to content

Instantly share code, notes, and snippets.

@DanDiplo
DanDiplo / JS-LINQ.js
Last active Dec 21, 2022
JavaScript equivalents of some common C# LINQ methods. To help me remember!
View JS-LINQ.js
// JS array equivalents to C# LINQ methods - by Dan B.
// First: This version using older JavaScript notation for universal browser support (scroll down for ES6 version):
// Here's a simple array of "person" objects
var people = [
{ name: "John", age: 20 },
{ name: "Mary", age: 35 },
{ name: "Arthur", age: 78 },
{ name: "Mike", age: 27 },
@choult
choult / Benthos HTTP-SSE parser
Last active Dec 21, 2022
Generic Benthos HTTP Server-Sent-Events ingest and parser
View Benthos HTTP-SSE parser
input:
broker:
copies: 1
inputs:
- http_client:
url: "https://mas.to/api/v1/streaming/public"
stream:
enabled: true
reconnect: true
codec: "delim:\n\n"
@leodutra
leodutra / -setup-windows-wsl-devenv.md
Last active Dec 21, 2022
Install and Setup Windows Subsystem 2 for Linux, Hyper, ZSH + Oh My Zsh + Powerlevel9k + plugins, FNM + VSCode (+ext) and Nerd Font
View -setup-windows-wsl-devenv.md

Setup Windows Subsystem 2 for Linux

Windows Subsystem 2 for Linux, Hyper, ZSH + Oh My Zsh + Powerlevel9k + plugins, FNM + VSCode (+ext) and Nerd Font

To setup native Linux, see this gist

Preview

Requirements

@mahmoudimus
mahmoudimus / fcntl.py
Created Dec 21, 2022
Fake fcntl module for windows
View fcntl.py
"""
This *fake* module is for windows only
Based on:
- https://github.com/facebook/tornado/blob/master/tornado/win32_support.py
- https://github.com/typecode/wikileaks/blob/23a6243df473102a9a1b84f5dde66173df3132b5/lib/tornado/win32_support.py
- https://raw.githubusercontent.com/twisted/twistedmatrix.com-trac-attachments/0a05e3294e7488d8864a73666a007db842c9633e/ticket/bc1/bc1a1f5e1875e3916492b3b509f58cd420eba1d5/b683c2d57b5d19e4fb24a78b44e76ad9129fe19f.patch
- https://github.com/yt-dlp/yt-dlp/blob/1fc089143c79b02b8373ae1d785d5e3a68635d4d/yt_dlp/utils.py#L2095-L2150
"""
View Quirks of C.md

Here's a list of mildly interesting things about the C language that I learned mostly by consuming Clang's ASTs. Although surprises are getting sparser, I might continue to update this document over time.

There are many more mildly interesting features of C++, but the language is literally known for being weird, whereas C is usually considered smaller and simpler, so this is (almost) only about C.

1. Combined type and variable/field declaration, inside a struct scope [https://godbolt.org/g/Rh94Go]

struct foo {
   struct bar {
 int x;
@b3z
b3z / binding.md
Last active Dec 21, 2022
DDNet binding cheatsheet
View binding.md

Teewords config cheatsheet

In this repository you will find a collection of teeworlds binds, configs and scripts which you can use in your settings_ddnet.cfg

If you feel like a bind is missing please contribute.


How binding works

@wbenny
wbenny / nt_syscalls.md
Last active Dec 21, 2022
Windows syscall stubs
View nt_syscalls.md

Windows system calls

...by stub

x86

Windows XP

B8 ?? ?? ?? ??                mov     eax, ??
BA 00 03 FE 7F                mov     edx, 7FFE0300h
@yumura
yumura / poco.psm1
Last active Dec 21, 2022
powershell peco
View poco.psm1
# Load
Split-Path $MyInvocation.MyCommand.Path -Parent | Push-Location
Get-ChildItem poco_*.ps1 | %{. $_}
Pop-Location
function Select-Poco
{
Param
(
[Object[]]$Property = $null,
@ErikEJ
ErikEJ / IQueryableExtensions.cs
Last active Dec 21, 2022
Replacement for EF Core .Contains, that avoids SQL Server plan cache pollution
View IQueryableExtensions.cs
public static class IQueryableExtensions
{
public static IQueryable<TQuery> In<TKey, TQuery>(
this IQueryable<TQuery> queryable,
IEnumerable<TKey> values,
Expression<Func<TQuery, TKey>> keySelector)
{
if (values == null)
{
@beached
beached / C++ normal operators.md
Last active Dec 21, 2022
A list of the normal signatures of C++ operators that allow overloading
View C++ normal operators.md

C++ Operator Signatures

This is a list of C++ operators that can be overloaded and their normal signatures(a.k.a what an int would do). The order is the preffered order to use them(The first one listed is often preffered)

Arithmetic

operator+ addition

  • free function -> T operator+( T const & lhs, T const & rhs )
  • member function -> T operator+( T const & rhs ) const

operator+ unary plus

  • member function -> T operator+( ) const