Skip to content

Instantly share code, notes, and snippets.

@nicolasff
nicolasff / Program.cs
Created August 21, 2023 02:46
Prevent UriParser in .NET from automatically simplifying URIs as if they were paths, like removing `/./` or considering `/../` as if it was a directory traversal (.NET 7)
using System.Reflection;
using ServiceStack;
namespace ConsoleApp;
public static class Program
{
static async Task Main(string[] args)
{
DoNotSimplifyUris();
@nicolasff
nicolasff / build-output.txt
Created March 15, 2022 14:20
Output from `make V=2` in `mpy-cross`
$ make V=2
GEN build/genhdr/mpversion.h
python3 ../py/makeversionhdr.py build/genhdr/mpversion.h
GEN build/genhdr/moduledefs.h
python3 ../py/makemoduledefs.py --vpath="., .., " py/mpstate.c py/malloc.c py/gc.c py/gc_long_lived.c py/pystack.c py/qstr.c py/vstr.c py/mpprint.c py/unicode.c py/mpz.c py/reader.c py/lexer.c py/parse.c py/scope.c py/compile.c py/emitcommon.c py/emitbc.c py/asmbase.c py/asmx64.c py/emitnx64.c py/asmx86.c py/emitnx86.c py/asmthumb.c py/emitnthumb.c py/emitinlinethumb.c py/asmarm.c py/emitnarm.c py/asmxtensa.c py/emitnxtensa.c py/emitinlinextensa.c py/emitnxtensawin.c py/formatfloat.c py/parsenumbase.c py/parsenum.c py/emitglue.c py/persistentcode.c py/runtime.c py/runtime_utils.c py/scheduler.c py/nativeglue.c py/pairheap.c py/ringbuf.c py/stackctrl.c py/argcheck.c py/warning.c py/profile.c py/map.c py/enum.c py/obj.c py/objarray.c py/objattrtuple.c py/objbool.c py/objboundmeth.c py/objcell.c py/objclosure.c py/objcomplex.c py/objdeque.c py/objdict.c py/objenumerate.c py/objexcept.c
@nicolasff
nicolasff / README.md
Created December 27, 2021 17:15
James Webb Space Telescope – Launch Telemetry (December 25, 2021)
@nicolasff
nicolasff / Test.java
Created January 8, 2021 22:45
NPE on switch(null)
public class Test {
enum Choice {
YES,
NO;
}
public static void main(String[] args) {
Choice c = null;
switch (c) {
/*
Better fix: run Brave with `--enable-features=VideoPlaybackQuality`, as suggested in https://github.com/brave/brave-browser/issues/13183#issuecomment-745491246
*/
$ cat test.hs
main = do
putStrLn "hello world"
$ ghc test.hs -o test
[1 of 1] Compiling Main ( test.hs, test.o ) [Optimisation flags changed]
Linking test ...
$ time ./test
hello world

Keybase proof

I hereby claim:

  • I am nicolasff on github.
  • I am nff (https://keybase.io/nff) on keybase.
  • I have a public key whose fingerprint is 86BC 671C 7C82 B250 92FB CB44 54E8 AC41 AA9A 7ACD

To claim this, I am signing this object:

@nicolasff
nicolasff / sample.cql
Created November 21, 2013 11:47
sample.cql
$ cat sample.cql
DROP KEYSPACE yo;
CREATE KEYSPACE yo WITH REPLICATION = {'class' : 'SimpleStrategy', 'replication_factor': 1};
USE yo;
CREATE TABLE test (
pk text,
val crdt('org.apache.cassandra.db.CeilFloorCrdt'),
PRIMARY KEY (pk))
@nicolasff
nicolasff / gist:7580238
Last active December 28, 2015 23:39
test.cql
$ cat test.cql
DROP KEYSPACE yo;
CREATE KEYSPACE yo WITH REPLICATION = {'class' : 'SimpleStrategy', 'replication_factor': 1};
USE yo;
CREATE TABLE foo (
x text,
y int,
z crdt('org.apache.cassandra.db.MinLongCrdt'),
t crdt('org.apache.cassandra.db.MaxLongCrdt'),
@nicolasff
nicolasff / ucontext-test.c
Created April 30, 2013 11:30
Testing the performance of swapcontext(3)
#include <stdio.h>
#include <stdlib.h>
#include <ucontext.h>
#include <sys/time.h>
#define COROUTINE_STACK_SIZE (1024 * 1024)
typedef struct {
ucontext_t ctx;
ucontext_t *prev;