Skip to content

Instantly share code, notes, and snippets.

View xoxwgys56's full-sized avatar
🚢
As it was

Yoooda xoxwgys56

🚢
As it was
View GitHub Profile
@gnarf
gnarf / ..git-pr.md
Last active January 27, 2025 01:56
git pr - Global .gitconfig aliases for Pull Request Managment

Install

Either copy the aliases from the .gitconfig or run the commands in add-pr-alias.sh

Usage

Easily checkout local copies of pull requests from remotes:

  • git pr 4 - creates local branch pr/4 from the github upstream(if it exists) or origin remote and checks it out
  • git pr 4 someremote - creates local branch pr/4 from someremote remote and checks it out
@ungoldman
ungoldman / curl_post_json.md
Last active April 28, 2025 09:21
post a JSON file with curl

How do you POST a JSON file with curl??

You can post a json file with curl like so:

curl -X POST -H "Content-Type: application/json" -d @FILENAME DESTINATION

so for example:

@staltz
staltz / introrx.md
Last active May 4, 2025 15:01
The introduction to Reactive Programming you've been missing
@ergoithz
ergoithz / xpath_soup.py
Last active January 11, 2025 16:34
Generate unique XPATH for BeautifulSoup element
#!/usr/bin/python
# -*- coding: utf-8 -*-
import bs4
def xpath_soup(element):
# type: (typing.Union[bs4.element.Tag, bs4.element.NavigableString]) -> str
"""
Generate xpath from BeautifulSoup4 element.
@odewahn
odewahn / error-handling-with-fetch.md
Last active June 9, 2024 14:27
Processing errors with Fetch API

I really liked @tjvantoll article Handling Failed HTTP Responses With fetch(). The one thing I found annoying with it, though, is that response.statusText always returns the generic error message associated with the error code. Most APIs, however, will generally return some kind of useful, more human friendly message in the body.

Here's a modification that will capture this message. The key is that rather than throwing an error, you just throw the response and then process it in the catch block to extract the message in the body:

fetch("/api/foo")
  .then( response => {
    if (!response.ok) { throw response }
    return response.json()  //we only get here if there is no error
 })
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active May 5, 2025 09:34
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@r00tdaemon
r00tdaemon / Install PyQt5 on Ubuntu with python3 .md
Last active March 3, 2025 02:10
Install PyQt5 on Ubuntu with python3. Steps to set up PyQt5 (ubuntu). With python code generation

Installation

pip3 install --user pyqt5  
sudo apt-get install python3-pyqt5  
sudo apt-get install pyqt5-dev-tools
sudo apt-get install qttools5-dev-tools

Configuring to run from terminal

@justsml
justsml / fetch-api-examples.md
Last active April 22, 2025 13:44
JavaScript Fetch API Examples
@jjangga0214
jjangga0214 / yarn.md
Last active March 3, 2025 12:13
[yarn] yarn 의 μ‚¬μš©λ°©λ²•μ— λŒ€ν•΄ μ„€λͺ…ν•œλ‹€. #yarn #npm

yarn

yarn 은 javascirpt 의 package manager 이닀. npm 의 drop-in substitute 둜 μ‚¬μš©ν•  수 μžˆλŠ” 점이 초기 λ„μž…μ—λ„ 큰 μž₯점이닀.
νŒ¨ν‚€μ§€ μ„€μΉ˜ 속도가 더 λΉ λ₯΄κ³ , νŒ¨ν‚€μ§€ μ„€μΉ˜κ³Όμ •μ—μ„œ νŒ¨ν‚€μ§€κ°€ codeλ₯Ό running ν•˜μ§€ μ•Šλ„λ‘ ν•˜μ—¬ 더 λ³΄μ•ˆμƒ μ•ˆμ „ν•˜λ‹€.
λ˜ν•œ, 같은 package.json 에 μ˜μ‘΄ν•˜λŠ” λ‘κ°œμ˜ μ„œλ‘œ λ‹€λ₯Έ ν™˜κ²½μ΄ μ„œλ‘œ λ‹€λ₯Έ λ²„μ „μ˜ νŒ¨ν‚€μ§€ μ˜μ‘΄μ„±μ„ κ°€μ§€λŠ” 것을 λ°©μ§€ν•˜κΈ° μœ„ν•΄, λ²„μ „μ˜ range κ°€ μ•„λ‹Œ, μ •ν™•ν•œ 버전을 λͺ…μ‹œν•œ yarn.lock νŒŒμΌμ„ μ‚¬μš©ν•œλ‹€.

μ£Όμš”

# npm install
yarn install λ˜λŠ” yarn
@npearce
npearce / install-docker.md
Last active April 26, 2025 04:27
Amazon Linux 2 - install docker & docker-compose using 'sudo amazon-linux-extras' command

UPDATE (March 2020, thanks @ic): I don't know the exact AMI version but yum install docker now works on the latest Amazon Linux 2. The instructions below may still be relevant depending on the vintage AMI you are using.

Amazon changed the install in Linux 2. One no-longer using 'yum' See: https://aws.amazon.com/amazon-linux-2/release-notes/

Docker CE Install

sudo amazon-linux-extras install docker
sudo service docker start