Skip to content

Instantly share code, notes, and snippets.

View gabsn's full-sized avatar
🇫🇷

Gabin Marignier gabsn

🇫🇷
View GitHub Profile
==================
WARNING: DATA RACE
Read at 0x00c42470c7c8 by goroutine 9:
  reflect.Value.Int()
      /home/vagrant/.gimme/versions/go1.8.linux.amd64/src/reflect/value.go:900 +0x181
  github.com/DataDog/dd-trace-go/vendor/github.com/ugorji/go/codec.(*encFnInfo).kInt()
      /home/vagrant/go/src/github.com/DataDog/dd-trace-go/vendor/github.com/ugorji/go/codec/encode.go:416 +0x50
  github.com/DataDog/dd-trace-go/vendor/github.com/ugorji/go/codec.(*Encoder).doEncodeValue()
      /home/vagrant/go/src/github.com/DataDog/dd-trace-go/vendor/github.com/ugorji/go/codec/encode.go:1222 +0xa1
@gabsn
gabsn / config
Last active September 18, 2017 21:07
A custom ~/ssh/config file
Host *
AddressFamily inet
Compression yes
ControlMaster auto
ControlPath /tmp/ssh_mux_%h_%p_%r
ControlPersist 720m
User gabin
IdentitiesOnly yes
IdentityFile ~/.ssh/id_rsa
ForwardAgent yes
@gabsn
gabsn / scan.go
Created September 25, 2017 15:22
[Redis] SCAN Pattern
var (
cursor int64
items []string
)
results := make([]string, 0)
for {
values, err := redis.Values(conn.Do("SSCAN", key, cursor))
if err != nil {
@gabsn
gabsn / report.md
Last active September 25, 2017 19:21
Datadog Internship

Internship Report

App Configuration

  • We can use different ways to configure an app: local/global variables, flags, environment variables, config files.
  • Solutions like viper exist for go apps to combine those solutions all together.
  • Should we use environment variables for app configuration?
    In my opinion, all the OS-dependent configuration options should be passed explicitly at the start of the application. Flags are the perfect way for that, because on the contrary of env variables, it's os-independent and explicit.

Here are all the reasons why we shouldn't use environment variables:

  • Dynamically set: they can be set by other users, so we are not really sure of their value across the time.
@gabsn
gabsn / grok-vi.md
Last active September 27, 2017 16:10
Your problem with Vim is that you don't grok vi.

Your problem with Vim is that you don't grok vi.

You mention cutting with yy and complain that you almost never want to cut whole lines. In fact programmers, editing source code, very often want to work on whole lines, ranges of lines and blocks of code. However, yy is only one of many way to yank text into the anonymous copy buffer (or "register" as it's called in vi).

The "Zen" of vi is that you're speaking a language. The initial y is a verb. The statement yy is a synonym for y_. The y is doubled up to make it easier to type, since it is such a common operation.

This can also be expressed as dd P (delete the current line and paste a copy back into place; leaving a copy in the anonymous register as a side effect). The y and d "verbs" take any movement as their "subject." Thus yW is "yank from here (the cursor) to the end of the current/next (big) word" and y'a is "yank from here to the line containing the mark named 'a'."

If you only understand basic up, dow

@gabsn
gabsn / abstract_data_types.md
Last active November 5, 2017 17:59
How to implement common ADTs given of the language

List

Java

ArrayList vs LinkedList vs Vector

We should always use ArrayList when we need a List, except for a few use cases where LinkedList is more adapted (when implementing a queue for example). We should also avoid using Vector which is a legacy class. If we need synchronisation, we will use the Collections.synchronizedList wrapper.

Method ArrayList LinkdedList
get(int i) O(1) O(n/4)
add(E e) O(1), O(n) worst-case O(1)
@gabsn
gabsn / cloudSettings
Last active August 1, 2021 16:55
VS Code config
{"lastUpload":"2021-08-01T16:54:58.756Z","extensionVersion":"v3.4.3"}
# module.app_dbs.google_sql_database.app will be created
le-beta_v3.7.0_x5: 2020/02/12 14:36:34 [INFO] Instantiating Google Cloud Spanner client for path https://spanner.googleapis.com/
+ resource "google_sql_database" "app" {
2020-02-12T14:36:34.149+0100 [DEBUG] plugin.terraform-provider-google-beta_v3.7.0_x5: 2020/02/12 14:36:34 [INFO] Instantiating Google Cloud Dataproc client for path https://dataproc.googleapis.com/
2020-02-12T14:36:34.149+0100 [DEBUG] plugin.terraform-provider-google-beta_v3.7.0_x5: 2020/02/12 14:36:34 [INFO] Instantiating Google Cloud Dataproc Beta client for path https://dataproc.googleapis.com/
2020-02-12T14:36:34.149+0100 [DEBUG] plugin.terraform-provider-google-beta_v3.7.0_x5: 2020/02/12 14:36:34 [INFO] Instantiating Filestore client for path https://file.googleapis.com/
2020-02-12T14:36:34.149+0100 [DEBUG] plugin.terraform-provider-google-beta_v3.7.0_x5: 2020/02/12 14:36:34 [INFO] Instantiating Google Cloud IoT Core client for path https://cloudiot.googleapis.com/
2020-02-12T1

Starknet Cheatsheet

Create devnet account

export STARKNET_WALLET=starkware.starknet.wallets.open_zeppelin.OpenZeppelinAccount
starknet --gateway_url http://127.0.0.1:5050 new_account --account toto
starknet --gateway_url http://127.0.0.1:5050 deploy_account --account toto

Debug failing transaction