Skip to content

Instantly share code, notes, and snippets.

View sombriks's full-sized avatar
🎧
discover new life, new galaxies, new civilizations -- [RUNNING]

Leonardo Silveira sombriks

🎧
discover new life, new galaxies, new civilizations -- [RUNNING]
View GitHub Profile
@knbr13
knbr13 / types.md
Created May 5, 2024 13:26
Data Types in Go

Data Types in Go

Go is a statically-typed language, which means that every variable has a specific data type that determines the kind of value it can hold. Go has several built-in data types that are categorized into four main groups: basic types, aggregate types, reference types, and interface types.

Basic Types

Basic types are the primitive data types in Go. They include:

  1. bool: Represents a boolean value, either true or false.
@GageSorrell
GageSorrell / Win32MessageLoopNodeAddonApi.cpp
Last active January 24, 2024 10:27
Create a Windows API (Win32) message loop with the node-addon-api.
/* Gist: Win32 Message Loop with `node-addon-api`
* Author: Gage Sorrell <gsorrell@purdue.edu>
* Copyright: (c) 2023 Gage Sorrell
* License: MIT
*/
/* This file demonstrates how to get access to the Windows API (Win32)
* message loop in your NodeJS application via node-addon-api.
* This code goes into your node-addon-api package, with no additional
* build tools necessary.
@maratori
maratori / golang-mocks.md
Last active July 19, 2024 11:10
Comparison of golang mocking libraries

Comparison of golang mocking libraries

Updated 2024-05-29

Uber
[gomock][6]
[testify][2] + [mockery][3] [minimock][4] [moq][5] Google
[gomock][1]

Library

GitHub stars [![s6]][6] [![s2]][2] + [![s3]][3] [![s4]][4] [![s5]][5] [![s1]][1]
Latest release date [![d6]][r6] [![d2]][r2] + [![d3]][r3] [![d4]][r4] [![d5]][r5] [![d1]][r1]
Maintained :white_check
@sanketsudake
sanketsudake / kind-kubernetes-metrics-server.md
Last active June 15, 2024 23:48
Running metric-server on Kind Kubernetes

I have created a local Kubernetes cluster with kind. Following are changes you need to get metric-server running on Kind.

Deploy latest metric-server release.

kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/download/v0.5.0/components.yaml

Within existing arguments to metric-server container, you need to add argument --kubelet-insecure-tls.

@derlin
derlin / DockerCassandra-InitDb.md
Last active April 27, 2024 18:29
Dockerfile and entrypoint example in order to easily initialize a Cassandra container using *.sh/*.cql scripts in `/docker-entrypoint-initdb.d`

Initializing a Cassandra Docker container with keyspace and data

This gist shows you how to easily create a cassandra image with initial keyspace and values populated.

It is very generic: the entrypoint.sh is able to execute any cql file located in /docker-entrypoint-initdb.d/, a bit like what you do to initialize a MySQL container.

You can add any *.sh or *.cql scripts inside /docker-entrypoint-initdb.d, but note that:

  • *.sh files will be executed BEFORE launching cassandra
@nickcernis
nickcernis / mariadb-brew-macos.md
Created July 13, 2020 15:13
Install MariaDB with brew on macOS and fix the “access denied” issue

Attempting mysql -u root fails with Access denied for user 'root'@'localhost immediately after doing brew install mariadb and starting mariadb with brew services start mariadb.

To fix it (with MariaDB still running):

  1. sudo mysql then enter your Mac user password
  2. ALTER USER 'root'@'localhost' IDENTIFIED BY 'newrootpassword'; replacing newrootpassword with the password you wish to use for the MariaDB root user.
  3. Ctrl-C to exit mysql.

You should then be able to connect to MariaDB with mysql -u root -p, then entering the root password when prompted.

@nsisodiya
nsisodiya / package.json
Created April 28, 2019 19:22
Nodemon ESM and inspect
{
"scripts": {
"start": "nodemon -r esm --inspect-brk --inspect=0.0.0.0:9229 src/server.js",
"test": "echo \"Error: no test specified\" && exit 1"
}
}
@jukkatupamaki
jukkatupamaki / 20190417131115_test-setup.ts
Last active June 21, 2023 07:03
How to use Knex.js in a TypeScript project
import { Knex } from 'knex'
export async function up(knex: Knex): Promise<any> {
await knex.schema.createTable('test_setup', (table: Knex.TableBuilder) => {
table.integer('foobar');
});
}
export async function down(knex: Knex): Promise<any> {
await knex.schema.dropTable('test_setup');
@rponte
rponte / Intervalo_t.sql
Last active January 19, 2022 16:21
PL/SQL: exemplo de Objeto com estado e comportamentos no Oracle - Intervalo (Date Range)
--------------------------------------------------------
-- Representa um Intervalo de datas (Date Range)
-- https://docs.oracle.com/cd/B10501_01/appdev.920/a96624/10_objs.htm
--------------------------------------------------------
create or replace type Intervalo_t FORCE as Object (
inicio Date
,fim Date
-- Construtores
,Constructor Function Intervalo_t(inicio Date, fim Date) Return Self as Result
@lkrych
lkrych / stubbing_fetch_api.js
Created November 6, 2017 16:16
Stubbing the fetch API with sinon
////Constants //////////////////////////////////////////////
function jsonOk (body) {
var mockResponse = new window.Response(JSON.stringify(body), { //the fetch API returns a resolved window Response object
status: 200,
headers: {
'Content-type': 'application/json'
}
});