Skip to content

Instantly share code, notes, and snippets.

@mkstayalive
mkstayalive / fn_ksuid.sql
Last active October 26, 2022 10:01 — forked from fabiolimace/ksuid.sql
Function for generating Segment's KSUIDs on PostgreSQL
/**
* Returns a Segment's KSUID.
*
* Reference implementation: https://github.com/segmentio/ksuid
* Also read: https://segment.com/blog/a-brief-history-of-the-uuid/
* Taken suggestions from: https://stackoverflow.com/a/71137273/518493
*/
CREATE EXTENSION pgcrypto;
CREATE OR REPLACE FUNCTION fn_ksuid(prefix text DEFAULT '') RETURNS text AS $$
@mkstayalive
mkstayalive / MarkdownUtils.java
Last active March 7, 2019 13:10
Slackdown-Java: Slack flavoured Markdown to HTML in Java using flexmark-java
import com.vladsch.flexmark.html.HtmlRenderer;
import com.vladsch.flexmark.parser.Parser;
import com.vladsch.flexmark.util.ast.Node;
import com.vladsch.flexmark.util.options.MutableDataSet;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* @author Manish Singh
@mkstayalive
mkstayalive / my.gitconfig
Created February 21, 2019 06:04
My Gitconfig
# This is Git's per-user configuration file.
[user]
email = manish@example.com
name = Manish Singh
[alias]
dev = !export tmp_cur_branch=\"$(git rev-parse --abbrev-ref HEAD)\" && git checkout dev && git pull origin dev && git checkout $tmp_cur_branch && git merge dev && git push origin $tmp_cur_branch
devwip = !export tmp_cur_branch=\"$(git rev-parse --abbrev-ref HEAD)\" && git checkout dev && git pull origin dev && git checkout $tmp_cur_branch && git merge dev
cpush = "!f() { export tmp_cur_branch=\"$(git rev-parse --abbrev-ref HEAD)\" && git add . && git commit -i -m \"$tmp_cur_branch $1\" . && git push origin $tmp_cur_branch; }; f"
alert('Hello World');