Skip to content

Instantly share code, notes, and snippets.

View ai7ch's full-sized avatar
💭
I may be slow to respond.

ai7ch ai7ch

💭
I may be slow to respond.
View GitHub Profile
@ai7ch
ai7ch / calendar
Created November 6, 2023 15:43 — forked from phuntik/calendar
i3blocks notify-send calendar
#! /bin/bash
send_current() {
TODAY=$(date '+%-d')
month=$(ncal -bhM)
BODY=$( tail -n7 <<< $month | sed -z "s/$TODAY/<span bgcolor='white' color='black'>$TODAY<\/span>/1" | sed "s/\(.*\)\(.\{7\}\)$/\1<span color='IndianRed'>\2<\/span>/")
HEAD=$(echo "$month" | head -n1)
notify-send -u critical \
"$HEAD" "$BODY"
}
@ai7ch
ai7ch / regular_expression_engine_comparison.md
Created September 13, 2023 13:56 — forked from CMCDragonkai/regular_expression_engine_comparison.md
Regular Expression Engine Comparison Chart

Regular Expression Engine Comparison Chart

Many different applications claim to support regular expressions. But what does that even mean?

Well there are lots of different regular expression engines, and they all have different feature sets and different time-space efficiencies.

The information here is just copied from: http://regular-expressions.mobi/refflavors.html

@ai7ch
ai7ch / git-commit-log-stats.md
Created April 26, 2023 13:02 — forked from eyecatchup/git-commit-log-stats.md
Some commands to get git commit log statistics for a repository on the command line.

git commit stats

Commands to get commit statistics for a Git repository from the command line -
using git log, git shortlog and friends.




@ai7ch
ai7ch / .psqlrc
Created October 30, 2022 11:26 — forked from jaytaylor/.psqlrc
My .psqlrc file.
-- Found at:
-- http://www.if-not-true-then-false.com/2009/postgresql-psql-psqlrc-tips-and-tricks/
-- http://opensourcedbms.com/dbms/psqlrc-psql-startup-file-for-postgres/
\set QUIET ON
\pset pager always
\pset null 'NULL'
@ai7ch
ai7ch / jwtRS256.sh
Created February 2, 2022 07:17 — forked from ygotthilf/jwtRS256.sh
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub
@ai7ch
ai7ch / psql-with-gzip-cheatsheet.sh
Created November 9, 2021 12:42 — forked from brock/psql-with-gzip-cheatsheet.sh
Exporting and Importing Postgres Databases using gzip
# This is just a cheat sheet:
# On production
sudo -u postgres pg_dump database | gzip -9 > database.sql.gz
# On local
scp -C production:~/database.sql.gz
dropdb database && createdb database
gunzip < database.sql.gz | psql database
@ai7ch
ai7ch / post-receive
Created March 24, 2021 23:04 — forked from tobru/post-receive
A git post-receive hook for Jekyll which supports branches
#!/usr/bin/env ruby
require 'fileutils'
GIT_REPO = '/home/me/mywebsite_ch.git'
TMP_GIT_CLONE = '/tmp/mywebsite_ch_clone'
DOCROOT = { 'master' => ENV['HOME']+'/public_html',
'draft' => ENV['HOME']+'/public_html_draft' }
@ai7ch
ai7ch / git-bundle-hook.md
Created March 20, 2021 13:25 — forked from stefansundin/git-bundle-hook.md
Git post-checkout and post-merge hooks to simplify bundling and other tasks.

Make bundleing and npm installing easy

These git hooks runs bundle or npm install automatically whenever you:

  • git checkout a new branch with a different Gemfile or package.json.
  • git pull a change to Gemfile or package.json.

How to install

  1. cd awesome_git_repo
@ai7ch
ai7ch / gist:224ccc94f60ea1ca9f3e6161c8b9bc6a
Created March 20, 2021 13:24 — forked from aludvigsen/gist:647d31d9ddbc37e96345
Git post-receive hook deployment using node, npm and PM2
#!/bin/sh
export GIT_WORK_TREE="/var/www/project"
echo "--> Checking out..."
git --work-tree=$GIT_WORK_TREE --git-dir=/var/repos/myrepo.git checkout -f
echo "--> NPM install..."
cd "$GIT_WORK_TREE"
npm install
@ai7ch
ai7ch / gist:facf45465d2244bf612fa029e4d40f65
Created March 18, 2021 21:25 — forked from jtdp/gist:5443297
See changes before pulling from remote git repository
# fetch the changes from the remote
git fetch origin
# show commit logs of changes
git log master..origin/master
# show diffs of changes
git diff master..origin/master
# apply the changes by merge..