Skip to content

Instantly share code, notes, and snippets.

<?
/////////////////////
// slack2html
// by @levelsio
/////////////////////
//
/////////////////////
// WHAT DOES THIS DO?
/////////////////////
//
@sgnl
sgnl / postgres-brew.md
Last active April 21, 2024 23:18
Installing Postgres via Brew (OSX) (outdated see top most note)

Outdated note: the process is a lot easier now: after you brew install postgresql you can initialize or stop the daemon with these commands: brew services start postgresql or brew services stop postgresql.

new out put may look like

To have launchd start postgresql now and restart at login:
  brew services start postgresql
Or, if you don't want/need a background service you can just run:
  pg_ctl -D /usr/local/var/postgres start
from pygit2 import Repository
from pygit2 import GIT_SORT_TOPOLOGICAL, GIT_SORT_REVERSE
import datetime
import json
import sys
class TzOffset(datetime.tzinfo):
def __init__(self, offset=19800, name=None):
self.offset = datetime.timedelta(seconds=offset)
@varemenos
varemenos / 1.README.md
Last active April 21, 2024 23:21
Git log in JSON format

Get Git log in JSON format

git log --pretty=format:'{%n  "commit": "%H",%n  "abbreviated_commit": "%h",%n  "tree": "%T",%n  "abbreviated_tree": "%t",%n  "parent": "%P",%n  "abbreviated_parent": "%p",%n  "refs": "%D",%n  "encoding": "%e",%n  "subject": "%s",%n  "sanitized_subject_line": "%f",%n  "body": "%b",%n  "commit_notes": "%N",%n  "verification_flag": "%G?",%n  "signer": "%GS",%n  "signer_key": "%GK",%n  "author": {%n    "name": "%aN",%n    "email": "%aE",%n    "date": "%aD"%n  },%n  "commiter": {%n    "name": "%cN",%n    "email": "%cE",%n    "date": "%cD"%n  }%n},'

The only information that aren't fetched are:

  • %B: raw body (unwrapped subject and body)
  • %GG: raw verification message from GPG for a signed commit
@qawemlilo
qawemlilo / paginate.js
Last active December 7, 2015 20:42
HBS helper for pagination
hbs.registerHelper('paginate', function(pagination, context) {
var lists = '';
if (pagination.isFirstPage) {
lists += '<li class="disabled"><a href="#">&laquo; Prev</a></li>';
}
else {
lists += '<li><a href="' + pagination.base + '?';
lists += 'p=' + pagination.prev + '">' + '&laquo; Prev</a></li>';
@sillage
sillage / flactags.sh
Last active December 23, 2023 18:44
flac tags with metaflac
#!/bin/bash
# file format: ARTIST/ALBUM/01-TITLE.flac
read -p "YEAR? " -n 4 YEAR
ALBUM="${PWD##*/}" # ALBUM=$(basename "${PWD}")
ARTIST=$(echo $(cd .. && echo "${PWD##*/}"))
# delete all
metaflac --preserve-modtime --remove-all-tags *.flac
# artist, album, year and cover
metaflac --preserve-modtime --set-tag=ARTIST="${ARTIST}" --set-tag=ALBUM="${ALBUM}" --set-tag=DATE=${YEAR} --import-picture-from=Folder.jpg *.flac
@VladSem
VladSem / tmux2_raspberry.sh
Created May 23, 2015 05:43
install tmux 2.0 on Raspberry Pi (Debian 7.8) Raspbian Wheezy
#!/bin/bash
wget "https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz"
tar -xf libevent-2.0.21-stable.tar.gz
cd libevent-2.0.21-stable
./configure
make
make verify
sudo make install
sudo ldconfig
@mRoca
mRoca / git_flow.md
Last active November 6, 2020 17:10
Git flow

Naming convention

Item Name
Release branch release/v2.0.1
Feature branch feature/my_feature_name
Feature branch feature/2234_my_feature_name
Hotfix branch hotfix/my_hotfix_name
Commit Add my news
Tag v2.0.1
@526avijitgupta
526avijitgupta / spacemacs-cheatsheet.md
Last active August 29, 2023 12:31
Spacemacs cheatsheet

emacs --daemon to run in the background. emacsclient.emacs24 <filename/dirname> to open in terminal

NOTE: "M-m and SPC can be used interchangeably".

  • Undo - C-/
  • Redo - C-?
  • Change case: 1. Camel Case : M-c 2. Upper Case : M-u
  1. Lower Case : M-l
@nzakas
nzakas / job.md
Last active August 29, 2015 14:18
Staff Software Engineer, Front-end Frameworks, Box

Staff Software Engineer, Front-end Frameworks (Los Altos, CA)

Box's Front-end Frameworks team is looking for an experienced engineer to join us at our Los Altos, CA headquarters on our mission to make building web applications on top of the Box infrastructure easy, fast, and fun.

About the Team

Front-end Frameworks ensures that Box web applications are built on top of the best tools and frameworks available. We actively evaluate third-party libraries and frameworks, as well as building our own, to make sure our feature teams can be as effective and iterative as possible. In the past two years, we've led the establishment of front-end best practices, created a lightweight client-side framework that has improved developer experience by enforcing conventions and loose coupling, and started putting together a Node.js framework to power the next generation of Box web applications.

About the Job