Skip to content

Instantly share code, notes, and snippets.

@willurd
willurd / web-servers.md
Last active November 13, 2024 13:44
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@Kartones
Kartones / postgres-cheatsheet.md
Last active November 15, 2024 21:14
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@codler
codler / flex.less
Last active October 7, 2023 07:01
Prefix flex for IE10 and Safari / iOS in LESS
/*! Prefix flex for IE10 and Safari / iOS in LESS
* https://gist.github.com/codler/2148ba4ff096a19f08ea
* Copyright (c) 2014 Han Lin Yap http://yap.nu; MIT license */
.display(@value) when (@value = flex) {
display: -ms-flexbox; // IE10
display: -webkit-flex; // Safari / iOS
}
.display(@value) when (@value = inline-flex) {
# GIT heart FZF
# -------------
is_in_git_repo() {
git rev-parse HEAD > /dev/null 2>&1
}
fzf-down() {
fzf --height 50% --min-height 20 --border --bind ctrl-/:toggle-preview "$@"
}
@dahlia
dahlia / query_debug.py
Last active May 4, 2018 18:12
Print SQLAlchemy queries (including bind params).
"""Print SQLAlchemy queries (including bind params).
See also: http://docs.sqlalchemy.org/en/latest/faq/sqlexpressions.html#faq-sql-expression-string
"""
def show_query(query):
qc = query.statement.compile(
dialect=query.session.bind.dialect,
@koshatul
koshatul / README.md
Last active October 9, 2024 07:06
use Apple Keychain to store GPG Passphrases

gpg-agent setup

Need to setup gpg-agent first, on OSX I use keychain (it also does ssh-agent)

$ brew info keychain
keychain: stable 2.8.5
User-friendly front-end to ssh-agent(1)
https://www.funtoo.org/Keychain
/usr/local/Cellar/keychain/2.8.5 (7 files, 108.5KB) *
@kanghyojun
kanghyojun / flake8-diagnostic-languageserver
Last active December 28, 2020 07:31
diagnostic-languageserver for flake8
{
"diagnostic-languageserver.filetypes": {
"python": "flake8"
},
"diagnostic-languageserver.linters": {
"flake8": {
"sourceName": "flake8",
"command": "flake8",
"args": [
"%file"
@drio
drio / alahack.lua
Last active August 14, 2022 14:54
cycle through alacritty instances in OSX via hammerspoon
--[[
This piece of hammer spoon code tries to address the issue of not being able to
switch between Alacritty instances in OSX.
Details: https://github.com/alacritty/alacritty/issues/607
To install:
1. Install hammer spoon (https://www.hammerspoon.org/)
2. Drop this file in your hammerspoon config directory:
$HOME/.hammerspoon/others/alahack.lua
@longfin
longfin / writing.md
Last active October 31, 2024 05:50
엔지니어를 위한 글쓰기

이 글은 Heinrich Hartmann 님이 작성하신 글을 한국어로 번역한 것입니다. 원문은 https://www.heinrichhartmann.com/posts/writing/ 에서 확인하실 수 있습니다.


글쓰기는 큰 조직에서 영향력을 발휘하는 데 중요합니다. 경력 있는 소프트웨어 엔지니어로서의 글쓰기는 직무 범위를 확장하고 경력을 발전시키기 위해 획득해야 하는 가장 중요한 기술입니다.

글쓰기는 어렵습니다. 많은 소프트웨어 엔지니어들이 글쓰기와 씨름하죠. 저도 개인적으로 문학에 대한 관심이 없기 때문에 글쓰기가 자연스럽지 않았습니다.