Skip to content

Instantly share code, notes, and snippets.

@seonghyeonkimm
seonghyeonkimm / 0-openapi-react-query.md
Last active December 13, 2024 04:25
OpenApi 스펙을 활용해서 type-safe하게 react-query 사용하기

OpenApi 스펙을 활용해서 type-safe하게 ReactQuery 사용하기

 graphql 백엔드와 통신하면서 프론트 작업을 할 때에는 graphql-codegen 사용해서 graphql schema를 기준으로 types을 generate해서 사용했었습니다. 그래서 따로 parameters, body, 그리고 response에 대해서 type을 따로 신경쓸 필요 없었고 type-safe하게 작업할 수 있었습니다. 그런데 이번에 시작한 프로젝트에서는 graphql가 아닌 rest api로 구성되어있는 백엔드와 통신해야하는 상황이 생겼고, 직접 type들을 타이핑을 해야한다고 생각하니 그렇게 하기가 싫었습니다. (물론, Paste JSON as Code을 사용하면 조금 더 편하게 할 수 있긴 하지만 모든 문제를 해결해주는 것은 아니기 때문에)

 예전에 최태건님이 FEConf에서 발표했던 OpenAPI Specification으로 타입-세이프하게 API 개발하기: 희망편 VS 절망편 영상을 보면서 백엔드에서 OpenApi 스펙을 제공해준다면 이 정보를 이용해서 typing을 만들어 낼 수 있다는 사실을 배웠던 것이 생각이 났고 새로운 프로젝트를 시작하는 김에 OpenApi를 사용해서 type을 generate하고 type-safe하게 react-query hook을 사용하고 싶었습니다. 그래서 개인적으로 어떻게 OpenApi 스펙과 몇 가지 라이브러리들을 활용해서 어떻게 react-query hook을 사용하고 있는지 정리해보려고합니다. 바로 그냥 코드만 보고 싶으신 분들은 [아래 링크](https://gist.github.com/seonghyeonkimm/977b58387f9f4e11afeee8c7685c2e89#file-1-use-oai-query-examp

@mwufi
mwufi / install_docker_in_colab.sh
Last active December 13, 2024 04:23
Install Docker in Google Colab!
# First let's update all the packages to the latest ones with the following command
sudo apt update -qq
# Now we want to install some prerequisite packages which will let us use HTTPS over apt
sudo apt install apt-transport-https ca-certificates curl software-properties-common -qq
# After that we will add the GPG key for the official Docker repository to the system
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
# We will add the Docker repository to our APT sources
@ednisley
ednisley / Platter Engraving.gcmc
Last active December 13, 2024 04:21
GCMC source code: Guilloche / Spirograph pattern generator with layer colors for laser cuttery
// Spirograph simulator
// Ed Nisley KE4ZNU - 2017-12-23
// Adapted for Guillioche plots with ball point pens - 2018-09-25
// 2019-06 Text on circular arcs
// 2019-08 Coordinate pruning
// 2019-09 Allow L > 1.0, proper scale to fit disk
// 2023-11 Strip down for SVG output, add layer colors for LightBurn
// Spirograph equations:
// https://en.wikipedia.org/wiki/Spirograph
@Nurlan199206
Nurlan199206 / CKA exam cheat sheet
Last active December 13, 2024 04:19
CKA exam cheat sheet
useful resources: https://github.com/ascode-com/wiki/tree/main/certified-kubernetes-administrator
alias ll='ls -l'
alias kcr='kubectl create'
alias ka='kubectl apply -f'
alias k=kubectl
alias kg='kubectl get'
alias ke='kubectl edit'
alias kd='kubectl describe'
alias kdd='kubectl delete'
@ambar
ambar / react.js
Last active December 13, 2024 04:14
jupyter deno react
import React from 'npm:react';
import ReactDOM from 'npm:react-dom/server';
// https://docs.jupyter.org/en/latest/reference/mimetype.html
const inspect = (obj: any) => {
if (React.isValidElement(obj)) {
return {
[Symbol.for('Jupyter.display')]() {
return {
'text/html': ReactDOM.renderToString(obj),
@notnotrobby
notnotrobby / cgp.md
Last active December 13, 2024 04:09
List of free resources to study computer graphics programming.
@realslacker
realslacker / RegToXml.psm1
Last active December 13, 2024 04:05
Converts a .REG file into an XML document that is compatible with GPO preferences. The registry file can contain updates or deletions. The resulting XML file can be copy and pasted, or drag and dropped onto the GPO preferences registry window to import the file.
<#
.SYNOPSIS
Converts a .REG file into an XML document that is compatible with GPO
preferences.
.DESCRIPTION
Converts a .REG file into an XML document that is compatible with GPO
preferences. The registry file can contain updates or deletions. The
resulting XML file can be copy and pasted, or drag and dropped onto the
GPO preferences registry window to import the file.
@andrewjmead
andrewjmead / jetformbuilder-submit-hook.php
Last active December 13, 2024 04:02
JetFormBuilder form submission hook for WordPress
<?php
/**
* JetFormBuilder has no documentation about what hooks they fire or when they fire them.
*
* I ended up digging into their source code to try and find an action that fires for all
* form submission, even if they don't have a custom "post submit action" set up.
*
* Using jet-form-builder/form-handler/after-send gets the job done.
*/
import 'package:analytics_example/analytics_property.dart';
/// A builder for analytics properties.
///
/// This class is used to build a map of properties
/// that can be sent to an analytics service.
final class AnalyticsBuilder {
AnalyticsBuilder() : properties = [];
/// The properties that have been added to this builder.
@eNV25
eNV25 / hp-bios-update.md
Last active December 13, 2024 03:59
Instructions to Update the BIOS/UEFI for an HP Laptop on Linux

Instructions to Update the BIOS/UEFI for an HP Laptop on Linux

To update the BIOS/UEFI firmware requires HP-specific files in the EFI System Partition, also referred to as ESP.

On a Linux system, the ESP is typically mounted on /boot/efi or /efi. Whithin you should also find a EFI directory, e.g. /boot/efi/EFI or /efi/EFI. This article assumes that the ESP is mounted on /efi and that the /efi/EFI directory exists. You can replace that with the mount point your system uses.

The HP-specific files are located in /efi/EFI/HP or /efi/EFI/Hewlet-Packard. These files typically come preinstalled in HP Windows PCs. If you have these files you could skip Install HP-specific files.