Skip to content

Instantly share code, notes, and snippets.

View mihai-craita's full-sized avatar

Mihai Craita mihai-craita

View GitHub Profile
@mihai-craita
mihai-craita / readme.md
Last active January 13, 2021 11:19
Convert json to csv

Using jq to generate a csv from a json file


The command will transform the json file users.json in csv, users.csv. The json has an array named items that contains different fields, here we select only id, name and the array perms. the tostring filter is applied to flatten the array perms

{
  "items": [
 {
@mihai-craita
mihai-craita / Justfile
Created August 12, 2023 04:32
Justfile using curl as an alternative to postman
BASE_URL := "http://localhost:3000"
### Posts ###
# Create a post
create-post:
@echo "Creating a new post..."
@curl -X POST -H "Content-Type: application/json" \
-d '{"title": "New Post", "content": "This is a new post."}' \
{{BASE_URL}}/posts
@mihai-craita
mihai-craita / main.rs
Created September 9, 2023 05:15
The final state of the code from this great talk "Type-Driven API Design in Rust" by Will Crichton: https://www.youtube.com/watch?v=bnnacleqg6k
use std::{time::Duration, iter::Iterator, thread::sleep};
const CLEAR: &str = "\x1B[2J\x1B[1;1H";
struct Unbounded;
struct Bounded {
bound: usize,
delims: (char, char)
}