Skip to content

Instantly share code, notes, and snippets.

@khalidx
khalidx / node-typescript-esm.md
Last active August 29, 2024 23:47
A Node + TypeScript + ts-node + ESM experience that works.

The experience of using Node.JS with TypeScript, ts-node, and ESM is horrible.

There are countless guides of how to integrate them, but none of them seem to work.

Here's what worked for me.

Just add the following files and run npm run dev. You'll be good to go!

package.json

@no-defun-allowed
no-defun-allowed / selling-lisp-by-the-pound.org
Last active April 17, 2024 06:10
Selling Lisp by the pound

Selling Lisp by the Pound

“Paper late!” cried a voice in the crowd,

“Old man dies!” The note he left was signed,

‘Old Kiczales’ - it seems he’s drowned!

@whiteinge
whiteinge / hello-report.txt
Last active May 11, 2024 16:36
File sizes for "hello world" in various comple-to-C and compile-to-binary languages
Default compiler settings used, unless noted otherwise. Host system is Fedora
x86_64. Linked libs produced via `ldd`.
Linked libs common to all below: linux-vdso libc ld-linux
Size Lang Specific libs Common libs
18K c - -
20K luastatic liblua libm libdl
22K vala libgobject libglib libffi libpcre libpthread

UPDATE:

These results are invalid. Some of the server implementations don't parse correctly and rust-tokio/ponylang-tcp don't seem to parse at all. See here for better benchmarks: https://gist.github.com/kprotty/5a41e9612657de00788478a7dde43d78

====

wrk -t4 -c128 -d10 --latency http://localhost:12345

  • Machine:
    • Intel Core i7-6700k (4 cores, 8 threads, 4.2ghz)
    • 16GB DDR4 2400mhz RAM
    • Arch Linux, Kernel 5.2.8
Command IDA Pro radare2 r2 (visual mode) GDB WinDbg
Analysis
Analysis of everything Automatically launched when opening a binary aaa or -A (aaaa or -AA for even experimental analysis) N_A N_A N/A
Navigation
@ffwff
ffwff / change-layout
Last active March 5, 2020 22:06
Changes layout of current i3 workspace
#!/bin/bash
if [[ "$1" = "fourbox" ]]; then
(i3-save-tree |sed -e's/^\s*\/\/\s[^\"].*//g' -e's/^\s*\/\///g' | \
jq '..|objects|select(.type=="con")|select(has("nodes")|not)'| \
jq -s '{layout:"splith","type":"con",nodes:[{"layout":"splitv",nodes:[.[0],.[1]]},{"layout":"splitv",nodes:[.[2],.[3]]}]}') > /tmp/layout
else
(i3-save-tree |sed -e's/^\s*\/\/\s[^\"].*//g' -e's/^\s*\/\///g' | \
jq '..|objects|select(.type=="con")|select(has("nodes")|not)'| \
jq -s '{layout:"'$1'","type":"con",nodes:.}') > /tmp/layout
@mbinna
mbinna / effective_modern_cmake.md
Last active September 16, 2024 15:44
Effective Modern CMake

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft

@Serikov
Serikov / main.cpp
Last active April 4, 2023 12:12
C++ Coroutines Ts generator<T> with co_await
#include <experimental/coroutine>
#include <stdexcept>
#include <variant>
namespace detail {
// simple type erasure for iterators
template<typename T>
struct generic_iterable
{
@karanlyons
karanlyons / method_missing.py
Last active August 7, 2017 17:47
method_missing for Python: All the headaches of Ruby, now with added whitespace!
import dis
import inspect
class MethodMissingMixin:
def __getattr__(self, attr):
if hasattr(getattr(self, '__methodmissing__', None), '__call__'):
parent_frame = inspect.currentframe().f_back
instructions = dis.get_instructions(parent_frame.f_code)
@tuxfight3r
tuxfight3r / s3_upload.sh
Last active March 27, 2024 08:42
AWS - Upload files to S3 via curl
#!/bin/bash -x
#Date: 21/7/2017
#Author: Mohan
#Purpose: To upload files to AWS S3 via Curl
#Uploads file at the top level folder by default
#S3 parameters
S3KEY="XXXXXXXXXXX"
S3SECRET="XXXXXXXXXXXXXXXX"