Skip to content

Instantly share code, notes, and snippets.

View sylr's full-sized avatar

Sylvain Rabot sylr

View GitHub Profile
package bench
import (
"testing"
"time"
)
func BenchmarkMarshalBinary(b *testing.B) {
bs := make([]byte, 16*4)
@sylr
sylr / Makefile
Last active July 6, 2024 16:02
Build go-tools with latest versions
GO ?= go
build: go.work
$(GO) build ./github.com/go-delve/delve/cmd/dlv
$(GO) build ./github.com/golangci/golangci-lint/cmd/golangci-lint
$(GO) build ./golang.org/x/tools/cmd/deadcode
$(GO) build ./golang.org/x/tools/gopls
install: go.work
$(GO) install ./github.com/daixiang0/gci/
@sylr
sylr / aoc-2023-day-01-1.sh
Created December 3, 2023 19:42
aoc-2023-day-01
echo "+/" $(sed -e 's/[^0-9]//g' -e 's/^\(.\)$/\1\1/' -e 's/^\(.\).*\(.\)$/\1\2/' ~/aoc-1.input) | ivy
# Convert X hours Y minutes to Z minutes
op a mins b = (0 60 decode a b)
# data hours minutes hours minutes ... etc
x = 0 53 1 32 0 53 1 6 1 9 0 41 1 3 1 1 1 2 2 17 0 46 1 36
# reduce
+/mins/((rho x)/2) 2 rho x
# hours
@sylr
sylr / FIX50SP2EP269.xml
Created April 27, 2022 09:06
FIX50SP2EP269.xml
This file has been truncated, but you can view the full file.
<?xml version="1.0"?>
<fix type="FIX" major="5" minor="0" servicepack="2">
<header/>
<messages>
<message name="IOI" msgtype="6" msgcat="app">
<component name="ApplicationSequenceControl" required="N"/>
<field name="IOIID" required="Y"/>
<field name="IOITransType" required="Y"/>
<field name="IOIRefID" required="N"/>
<component name="Instrument" required="Y"/>
@sylr
sylr / index.html
Created March 15, 2022 15:06
mdpJBqv
<div>pwet</div>
@sylr
sylr / fg-flatten-addrgrp.py
Last active July 22, 2021 15:33
Flatten fortigate address group members
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# This file is part based on github.com/maaaaz/fgpoliciestocsv
#
# Copyright (C) 2021, Sylvain Rabot <sylvain at abstraction .fr>
# Copyright (C) 2014, 2020, Thomas Debize <tdebize at mail.com>
# All rights reserved.
#
# This script is a free software: you can redistribute it and/or modify
@sylr
sylr / fgflatten.py
Last active June 22, 2021 14:08
Fortigate config address group flattening script
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# This file is based on github.com/maaaaz/fgpoliciestocsv
#
# Copyright (C) 2021, Sylvain Rabot <sylvain at abstraction .fr>
# Copyright (C) 2014, 2020, Thomas Debize <tdebize at mail.com>
# All rights reserved.
#
# This script is a free software: you can redistribute it and/or modify
from __future__ import absolute_import, division, print_function
import argparse
import http.server
import json
import sys
import urllib.parse
import webbrowser
from urllib.parse import urlparse
import requests
### Keybase proof
I hereby claim:
* I am sylr on github.
* I am sylr (https://keybase.io/sylr) on keybase.
* I have a public key ASAiPbnJcHTFwPhDIKPs78SeFplZqxnISRvCAcPsuOtzxgo
To claim this, I am signing this object: