Skip to content

Instantly share code, notes, and snippets.

View Astro36's full-sized avatar

Seungjae Park Astro36

View GitHub Profile
@Astro36
Astro36 / .clang-format
Last active August 26, 2020 07:25
My C++ Clang-Format Style
# https://gist.github.com/Astro36/211443b279e964af9b2ed05ddec0b1ee
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
# AlignConsecutiveMacros: false
AlignEscapedNewlines: DontAlign
AlignOperands: true
AlignTrailingComments: false
# AllowAllArgumentsOnNextLine: false
@Astro36
Astro36 / renew-certbot.sh
Created May 30, 2020 07:26
Renew Let's Encrypt Certificate
sudo nginx -s stop
sudo certbot renew
nginx
@Astro36
Astro36 / .vimrc
Last active May 1, 2020 13:38
My Vim Config
colorscheme delek
set nu
set mouse=a
set ruler
set shiftwidth=4
set tabstop=4
set softtabstop=4
#include <iostream>
template<unsigned int N>
constexpr unsigned int factorial_v = N * factorial_v<N - 1>;
template<>
constexpr unsigned int factorial_v<1> = 1;
template<unsigned int N, unsigned int K>
constexpr unsigned int binomial_v = factorial_v<N> / (factorial_v<K> * factorial_v<N - K>);
template<typename T, typename Index = std::size_t, typename = void>
struct has_subscript_operator : std::false_type {};
template<typename T, typename Index>
struct has_subscript_operator<T, Index, std::void_t<decltype(std::declval<T>()[std::declval<Index>()])>> : std::true_type {};
template<typename T, typename Index = int>
using has_subscript_operator_v = typename has_subscript_operator<T, Index>::value;
template<typename T>
@Astro36
Astro36 / iterable.h
Last active March 29, 2020 14:17
Check if arbitrary type can use for-each loop by using C++ SFINAE
#include <iterator>
#include <type_traits>
template<typename T, typename = void>
struct is_iterable : std::false_type {};
template<typename T>
struct is_iterable<T, std::void_t<decltype(*std::begin(std::declval<T&>()) != *std::end(std::declval<T&>())),
decltype(++std::declval<decltype(std::begin(std::declval<T&>()))&>())>> : std::true_type {};
const date = new Date();
const seed = date.getFullYear() * 10000 + (date.getMonth() + 1) * 100 + date.getDate();
let nums = [...new Array(50).keys()]; // [0, 1, 2, 3, ..., 29];
const rand = (() => {
let next = seed;
return () => (next = (1103515245 * next + 12345) % 10000000) % 3;
})();
@Astro36
Astro36 / README.md
Last active November 5, 2019 15:30
How to start Raspberry Pi

How to start Raspberry Pi

1. Install Raspbian at Raspberry Pi

Download Raspbian

Download balenaEtcher

2. Connect to Raspberry Pi

@Astro36
Astro36 / README.md
Last active August 7, 2023 18:47
How to install Solus with Windows 10

How to install Solus with Windows 10

1. Install Windows 10

Install Windows 10.

2. Install Solus

  1. Boot into Solus Live USB Drive.
  2. Run GParted.
@Astro36
Astro36 / .clang-format
Last active July 29, 2021 06:37
Rust-like Clang-Format Style
# https://gist.github.com/Astro36/ef933be73050b4d5a6e0522536723a18
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
# AlignConsecutiveMacros: false
AlignEscapedNewlines: DontAlign
AlignOperands: true
AlignTrailingComments: false
# AllowAllArgumentsOnNextLine: false