Skip to content

Instantly share code, notes, and snippets.

View attomos's full-sized avatar
💆‍♀️

Nattaphoom Chaipreecha attomos

💆‍♀️
View GitHub Profile
@pierrejoubert73
pierrejoubert73 / markdown-details-collapsible.md
Last active October 31, 2025 13:24
How to add a collapsible section in markdown.

How to add a collapsible section in markdown

1. Example

Click me

Heading

  1. Foo
  2. Bar
    • Baz
  • Qux
@zkat
zkat / index.js
Last active April 30, 2025 21:38
npx is cool
#!/usr/bin/env node
console.log('yay gist')
@a-yee
a-yee / nvimCondaEnv.txt
Last active December 24, 2024 11:53
Setting up neovim python3 environment using conda
# bash commands
# lists all of your conda env
conda env list
# Create a conda env w/ python3.5
# -n sets the name for your new env. I call it neovim here
conda create -n neovim python=3.5
# add neovim for python3 to the env
# specify version you want here, 0.1.13 up to date ver atm
@csturtevant
csturtevant / uninstal_prezto.zsh
Last active September 13, 2023 22:28
uninstall prezto from home directory
rm -rf ~/.zprezto ~/.zlogin ~/.zlogout ~/.zpreztorc ~/.zprofile ~/.zshenv
@gyribeiro
gyribeiro / tmux_italic.md
Last active September 6, 2025 12:36
enable italic font on tmux
@fokusferit
fokusferit / enzyme_render_diffs.md
Last active September 19, 2025 19:40
Difference between Shallow, Mount and render of Enzyme

Shallow

Real unit test (isolation, no children render)

Simple shallow

Calls:

  • constructor
  • render
@developer-sdk
developer-sdk / hive-str_to_map.sql
Created April 5, 2017 14:56
hive: str_to_map()
-- STR_TO_MAP 사용법
SELECT STR_TO_MAP("key1: value1, key2: value2, key3: value3", list_delimiter, key_value_delimiter);
-- example #1
hive> SELECT STR_TO_MAP("key1: value1, key2: value2, key3: value3", ",", ":");
OK
{"key1":" value1"," key3":" value3"," key2":" value2"}
Time taken: 0.049 seconds, Fetched: 1 row(s)
-- json string to map
@jesperorb
jesperorb / cors.md
Last active February 21, 2024 14:17
Handle CORS Client-side

Handle CORS Client-side

Cross-origin resource sharing (CORS) is a mechanism that allows restricted resources (e.g. fonts) on a web page to be requested from another domain outside the domain from which the first resource was served. This is set on the server-side and there is nothing you can do from the client-side to change that setting, that is up to the server/API. There are some ways to get around it tho.

Sources : MDN - HTTP Access Control | Wiki - CORS

CORS is set server-side by supplying each request with additional headers which allow requests to be requested outside of the own domain, for example to your localhost. This is primarily set by the header:

Access-Control-Allow-Origin
@raaka1
raaka1 / LevelDb
Created December 11, 2016 14:43
LEVELDB hello world
#include <cassert>
#include <leveldb/db.h>
#include <iostream>
#include <string>
using namespace std;
int main() {
leveldb::DB* db;
leveldb::Options options;
options.create_if_missing = true;
@BretFisher
BretFisher / docker-swarm-ports.md
Last active August 12, 2024 16:10
Docker Swarm Port Requirements, both Swarm Mode 1.12+ and Swarm Classic, plus AWS Security Group Style Tables

Docker Swarm Mode Ports

Starting with 1.12 in July 2016, Docker Swarm Mode is a built-in solution with built-in key/value store. Easier to get started, and fewer ports to configure.

Inbound Traffic for Swarm Management

  • TCP port 2377 for cluster management & raft sync communications
  • TCP and UDP port 7946 for "control plane" gossip discovery communication between all nodes
  • UDP port 4789 for "data plane" VXLAN overlay network traffic
  • IP Protocol 50 (ESP) if you plan on using overlay network with the encryption option

AWS Security Group Example