Skip to content

Instantly share code, notes, and snippets.

View Hammadk's full-sized avatar
👽

Hammad Khalid Hammadk

👽
View GitHub Profile
@Hammadk
Hammadk / gist:0a196dd1ac5ad971df1a
Last active April 24, 2016 02:20
git pre-push hook: get warned before pushing to git master branch
#!/bin/bash
# Warn before pushing to protected branches
# Make script executable with chmod +x pre-push
# Bypass with git push --no-verify
BRANCH=`git rev-parse --abbrev-ref HEAD`
PROTECTED_BRANCHES="^(master|dev|release-*|patch-*)"
if [[ "$BRANCH" =~ $PROTECTED_BRANCHES ]]; then
read -p "Are you sure you want to push to \"$BRANCH\" ? (y/n): " -n 1 -r < /dev/tty
@Hammadk
Hammadk / example.sql
Last active January 12, 2024 20:13
Cases where Lookup Vindexes are not required to enforce global uniqueness.
# All tables have a user_id column, and the keyspace is sharded by this column.
CREATE TABLE `products` (
`id` BIGINT NOT NULL,
`user_id` BIGINT NOT NULL,
PRIMARY KEY (`id`)
)
CREATE TABLE `orders` (
`id` BIGINT NOT NULL,