Skip to content

Instantly share code, notes, and snippets.

View jsonzilla's full-sized avatar
👨‍🌾

Jason jsonzilla

👨‍🌾
View GitHub Profile
@dasniko
dasniko / create_x509_certs.md
Last active August 29, 2024 13:38
Creating self signed tls certificates with self-signed root CA
@coltenkrauter
coltenkrauter / fix-wsl2-dns-resolution
Last active November 1, 2024 16:58
Fix DNS resolution in WSL2
More recent resolution:
1. cd ~/../../etc (go to etc folder in WSL).
2. echo "[network]" | sudo tee wsl.conf (Create wsl.conf file and add the first line).
3. echo "generateResolvConf = false" | sudo tee -a wsl.conf (Append wsl.conf the next line).
4. wsl --terminate Debian (Terminate WSL in Windows cmd, in case is Ubuntu not Debian).
5. cd ~/../../etc (go to etc folder in WSL).
6. sudo rm -Rf resolv.conf (Delete the resolv.conf file).
7. In windows cmd, ps or terminal with the vpn connected do: Get-NetIPInterface or ipconfig /all for get the dns primary and
secondary.
@ServerlessBot
ServerlessBot / IAMCredentials.json
Last active December 20, 2023 16:50
Minimum credential set for Serverless Framework
{
"Statement": [
{
"Action": [
"apigateway:*",
"cloudformation:CancelUpdateStack",
"cloudformation:ContinueUpdateRollback",
"cloudformation:CreateChangeSet",
"cloudformation:CreateStack",
"cloudformation:CreateUploadBucket",
@renatoapcosta
renatoapcosta / rest_modelo_maturidade_richardson.md
Last active February 15, 2024 15:05
Modelo de maturidade Richardson

Modelo de maturidade Richardson

Apesar de Roy Fielding deixar bastante claro que para uma API ser considerada RESTful ela precisa obrigatoriamente seguir todas as constraints definidas em seu trabalho, na prática, muitas vezes precisamos de uma abordagem um pouco mais simples.

Sendo assim, Leonard Richardson propôs um modelo de 4 níveis para que alcancemos uma API REST.

Os níveis 0, 1 e 2 talvez sejam mais familiares, e de fato são mais fáceis de implementar, porém, deve ficar claro que os mesmos não são considerados RESTful.

screen shot 2018-08-12 at 19 56 38

Thread Pools

Thread pools on the JVM should usually be divided into the following three categories:

  1. CPU-bound
  2. Blocking IO
  3. Non-blocking IO polling

Each of these categories has a different optimal configuration and usage pattern.

#include <windows.h>
#include <GL/gl.h>
#include <stdio.h>
#pragma comment(lib, "opengl32.lib")
void glview()
{
HWND hWnd = CreateWindow(L"ListBox", L"Title", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, NULL, NULL);
HDC hDC = GetDC(hWnd);
@mjdietzx
mjdietzx / waya-dl-setup.sh
Last active October 14, 2024 12:19
Install CUDA Toolkit v8.0 and cuDNN v6.0 on Ubuntu 16.04
#!/bin/bash
# install CUDA Toolkit v8.0
# instructions from https://developer.nvidia.com/cuda-downloads (linux -> x86_64 -> Ubuntu -> 16.04 -> deb (network))
CUDA_REPO_PKG="cuda-repo-ubuntu1604_8.0.61-1_amd64.deb"
wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/${CUDA_REPO_PKG}
sudo dpkg -i ${CUDA_REPO_PKG}
sudo apt-get update
sudo apt-get -y install cuda
@mmozeiko
mmozeiko / overlapped_named_pipe.cpp
Last active March 15, 2024 13:06
Example how to use read-only named pipes with single client in non-blocking way on single thread
#include <windows.h>
#include <stdio.h>
#include <assert.h> // for potential error handling, change to real errors in your code
int main()
{
HANDLE pipe = CreateNamedPipeW(
L"\\\\.\\pipe\\lolcat",
PIPE_ACCESS_INBOUND | FILE_FLAG_FIRST_PIPE_INSTANCE | FILE_FLAG_OVERLAPPED,
PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT | PIPE_REJECT_REMOTE_CLIENTS,
@curran
curran / README.md
Last active October 5, 2024 11:47
The Iris Dataset

This is the "Iris" dataset. Originally published at UCI Machine Learning Repository: Iris Data Set, this small dataset from 1936 is often used for testing out machine learning algorithms and visualizations (for example, Scatter Plot). Each row of the table represents an iris flower, including its species and dimensions of its botanical parts, sepal and petal, in centimeters.

The HTML page provides the basic code required to load the data and display it on the page (as JSON) using D3.js.

For a more up to date code example with React & D3, see (VizHub: Stylized Scatter Plot)[https://vizhub.com/curran/3d631093c2334030a6b27fa979bb4a0d?edit=files&file=index.js].

@pchiusano
pchiusano / type-inhabitants.markdown
Last active January 7, 2023 17:23
Reasoning about type inhabitants in Haskell

This is material to go along with a 2014 Boston Haskell talk.

We are going to look at a series of type signatures in Haskell and explore how parametricity (or lack thereof) lets us constrain what a function is allowed to do.

Let's start with a decidedly non-generic function signature. What are the possible implementations of this function which typecheck?

wrangle :: Int -> Int