Skip to content

Instantly share code, notes, and snippets.

View scarf005's full-sized avatar

scarf scarf005

View GitHub Profile
#include <algorithm>
#include <concepts>
#include <iostream>
#include <list>
#include <string>
#include <string_view>
#include <vector>
// https://godbolt.org/#z:OYLghAFBqd5QCxAYwPYBMCmBRdBLAF1QCcAaPECAMzwBtMA7AQwFtMQByARg9KtQYEAysib0QXACx8BBAKoBnTAAUAHpwAMvAFYTStJg1DIApACYAQuYukl9ZATwDKjdAGFUtAK4sGIM6SuADJ4DJgAcj4ARpjEEpLSAA6oCoRODB7evv6kyamOAiFhkSwxcVLSdpgO6UIETMQEmT5%2BAVU1AnUNBEUR0bHxlfWNzdltwz2hfaUDFQCUtqhexMjsHOYAzKHI3lgA1CYbbmLAJIQILIfYJhoAgpvbu5gHR2gMq4kEClc392Zb7yeLzcTgUBGImFYPzuD0BXn2hzctDwYOhfwBO3hz0RYOIoWAaNhmIRR1x%2BIA%2BgA3PCYADuhP%2BjyxwMp1SIxEJdwImBYiQM3OBOyYCgUe2uG2udzeHwIeywVCYXloBHJsWFTCi9BeABE9hCAI5ePAQhQQbAAKj2iTmBwA7FY7ns9mD0CAQFhcagAJ7kpgECDWw4O%2B627VB36/bm8/nY14GEVi0h7IUJgAqSZTovuEt%2B0swnz2YloqFE7NVxHVmtjuoNRpNEFuexYSYtVptJntvydteNmFFLrdClYmF93yOBC9iUYw72qbdRZLfpI5InU9IXadm63253m9X07YzoIrpAC9Ly/BTEIY7c2ewbqjfL9zwhUVC6F9tGLpiO4r/4cdI8TzPJdiBXCtr0RO83Q9cFvQgZs2wAkMww2YNIx5J8BURTNZzRPMCxAssmFpBpqz1TBDV7U1U0LdtO0AjsLELAA6YBMBVIiSAgejdQAWiuIDB2HUdEX3ZhDznU8v0XMt9x%2BNCI1DZCMOjZ9BXjUVUzRX
#!/usr/bin/env python3
"""Fake git commits.
Usage:
fakecommit.py [-h] [--git=<git>] --date=<date> [-d] [--] <args>...
Options:
-h, --help Show this help message and exit.
-d, --dry Dry run.
--git=<git> alternative git-like program to use. [default: git]
@scarf005
scarf005 / tvtrope.user.js
Last active July 19, 2022 09:44
show link preview and stuff
// ==UserScript==
// @name tvTrope Show links
// @namespace http://gist.github.com/scarf005
// @version 0.2.0
// @description show link preview and stuff
// @author scarf005
// @match https://tvtropes.org/pmwiki/pmwiki.php/*
// @grant none
// ==/UserScript==
@scarf005
scarf005 / clip.py
Last active September 14, 2022 08:44
clipboard helper
#!/bin/env python3
import io
from subprocess import PIPE, Popen, run
from sys import stdin
from typing import TextIO
import click
from pyperclip import copy, paste # type: ignore
@scarf005
scarf005 / turingio.py
Last active September 22, 2022 04:39
turing.io code into ft_turing program
#!/bin/env python3
import json
from pathlib import Path
from typing import Any, Literal
import yaml
Action = dict[str, str]
Match = dict[str, Action]
from __future__ import annotations
from collections import deque
from dataclasses import dataclass
from enum import IntEnum
from functools import cached_property
from typing import List, Tuple
Grid = List[List[int]]
@scarf005
scarf005 / songs.txt
Last active September 24, 2022 10:23
미래가 추천하는 노래방에서 부르면 분위기가 좋아지는 노래 50선
네미시스 - 베르사이유의 장미
네미시스 - 솜사탕
네미시스 - 이쁜이
디제이디오씨 - 사랑을 아직도 난
자우림 - 새
자우림 - 낙화
자우림 - 이틀 전에 죽은 그녀와의 채팅은
자우림 - 파애
이브 - I'll Be There
이브 - 집착의 병자
@scarf005
scarf005 / nix.md
Last active September 29, 2022 09:19

Nixos 문제 해결

ibus korean-hangul 설치

supportedLocales를 추가하지 않으면 ibus에 korean-hangul메뉴가 생기지 않는 것으로 보임 (

  i18n = { 
    defaultLocale = "ko_KR.utf8"; 
    supportedLocales = ["all"];
  
    # ibus configuration
@scarf005
scarf005 / vscode.md
Created September 30, 2022 10:25
42와 vscode

42와 vscode

vscode 경로를 PATH에 추가하기

커맨드라인에서 실행 가능하므로 사용/오류 해결에 편리

  1. 초기 설정으로 사용할 경우 /Applications/Visual\ Studio\ Code\ 2.app/Contents/Resources/app/bin
  2. export PATH=$PATH:"/Applications/Visual\ Studio\ Code\ 2.app/Contents/Resources/app/bin" 를 ~/.zshrc`에 추가

vscode 버튼을 실행해도 아무것도 뜨지 않을 때

vscode 캐시와 로컬 파일을 goinfre/에 심볼릭 연결했을 가능성이 높음

  1. code --status를 터미널에 입력하여 ENOENT에러가 나는지 확인
  2. goinfre/로 향하는 심볼릭 링크는 있으나 가리키는 디렉터리가 존재하지 않아 문제 발생 (goinfre는 자리마다 초기화됨)
@scarf005
scarf005 / util.js
Last active October 16, 2022 11:28
userscript utils
'use strict'
/** @param {string} s */
export const capitalize = s => s.charAt(0).toUpperCase() + s.slice(1).toLowerCase()
/**
* @param {string} cls
* @returns {HTMLElement[]}
*/
export const getDomArray = (cls) => Array.from(document.querySelectorAll(cls))