Skip to content

Instantly share code, notes, and snippets.

View alice1017's full-sized avatar

Alice1017 alice1017

  • Tokyo, Japan
View GitHub Profile
@mikowl
mikowl / oneliners.js
Last active June 29, 2024 17:39
👑 Awesome one-liners you might find useful while coding.
// Inspired by https://twitter.com/coderitual/status/1112297299307384833 and https://tapajyoti-bose.medium.com/7-killer-one-liners-in-javascript-33db6798f5bf
// Remove any duplicates from an array of primitives.
const unique = [...new Set(arr)]
// Sleep in async functions. Use: await sleep(2000).
const sleep = (ms) => (new Promise(resolve => setTimeout(resolve, ms)));
// or
const sleep = util.promisify(setTimeout);
@kk6
kk6 / mstdn.py
Last active July 31, 2017 23:28
Pythonでmastodon APIを叩くやつ
# -*- coding: utf-8 -*-
from urllib.parse import urlunsplit
import requests
from oauthlib.oauth2 import LegacyApplicationClient
from requests_oauthlib import OAuth2Session
def register_app(client_name, host, redirect_uris='urn:ietf:wg:oauth:2.0:oob',
scopes='read write follow'):
@okapies
okapies / mastodon-client.md
Last active October 3, 2023 10:18
Mastodon API の叩き方

Mastodon の API を叩くには以下の手順を踏む必要がある:

  1. OAuth2 クライアントを登録する
  2. アクセストークンを取得する
  3. アクセストークンを Authorization ヘッダに指定して API にアクセスする

OAuth2 クライアント登録

Mastodon の Apps API に登録情報を送ってクライアントを払い出してもらう(一度だけやれば OK).

@kanryu
kanryu / genchangelog.awk
Last active March 30, 2017 19:32
minimalist auto generator for CHANGELOG.md (awk)
BEGIN {
print "# CHANGELOG"
COMMIT = ""
OTHER_COMMIT_FIRST=1
DATE = ""
TAG = ""
"git config --get remote.origin.url" | getline ORIGIN
}
/^commit/ {
@mplewis
mplewis / LICENSE.md
Last active June 3, 2022 02:55
git blame with colored authors and pygments syntax highlighting. Dependencies: `pip install pygments tabulate colored`. License: MIT

The MIT License (MIT)

Copyright © 2021 Matt Lewis

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFT

# -*- coding: utf-8 -*-
"""Demonstrate high quality docstrings.
Module-level docstrings appear as the first "statement" in a module. Remember,
that while strings are regular Python statements, comments are not, so an
inline comment may precede the module-level docstring.
After importing a module, you can access this special string object through the
``__doc__`` attribute; yes, it's actually available as a runtime attribute,
despite not being given an explicit name! The ``__doc__`` attribute is also
#!/bin/sh
#coding: utf-8
GET="wget --no-check-certificate"
# move homedir
cd ~
# clone
mkdir .vim
@dogrunjp
dogrunjp / Markup_markdown_with_jinja2.md
Last active November 30, 2015 15:14
PythonのテンプレートエンジンJinja2にMarkdownを読み込みレンダリングする方法

PythonのテンプレートエンジンJinja2にMarkdownを読み込みレンダリングする方法

タイトルの通りのことを色々試していたのでメモしておきます。

1)テンプレートフィルタの利用

Jinja2とMarkdownで検索して、 最初に見つけたのがDjango+Jinja2でMarkdown用のカスタムフィルタを使う方法。 テンプレートに関する部分はだいたいJinja2なので、Djangoに関係なくMarkdownを扱えます。

@Kuniwak
Kuniwak / 2013_11_15_githubjp_note.markdown
Last active October 30, 2018 07:06
「GitHub トレーニングチームから学ぶ Git の内部構造」のノートです。 曖昧なところもあるので、間違いがあったら教えてください! http://connpass.com/event/3808/

GitHub トレーニングチームから学ぶ Git の内部構造

Graphs, Hashes, and Compression, Oh My!

Hash について

従来の CVCS (集中バージョン管理システム)のリビジョン番号は連番。 SVN はサーバーにデプロイした時点でリビジョン番号1と設定される。

@jonschlinkert
jonschlinkert / markdown-cheatsheet.md
Last active November 18, 2024 08:04
A better markdown cheatsheet.