Skip to content

Instantly share code, notes, and snippets.

View burhan's full-sized avatar
💻

Burhan Khalid burhan

💻
View GitHub Profile
@burhan
burhan / emojis.json
Created July 3, 2024 12:34
Snippets for Raycast based on the Emoji Picker pack for Alfred
[
{
"name": "♣ :clubs:",
"text": "♣",
"keyword": ":clubs:"
},
{
"name": "🇿🇲 :flag zm: (zambia)",
"text": "🇿🇲",
"keyword": ":flag zm:"
@burhan
burhan / zshrc
Last active May 8, 2024 09:53
common zshrc configuration
alias eza='eza -xZo --smart-group --icons --header --git --time-style "long-iso"'
alias exa='eza'
alias ls='lsd'
alias ll='lsd -laG'
alias l.='lsd -dG .*'
alias tree='lsd -l --tree --depth=2'
alias grep='grep --color'
alias ..='cd ..'
alias ....='cd ../..'
alias ......='cd ../../..'
@burhan
burhan / openssl-cheat-sheet.sh
Created July 19, 2020 11:40
OpenSSL Cheat Sheet
# Generate new CSR and private key
openssl req -out CSR.csr -new -newkey rsa:2048 -nodes -keyout privateKey.key
# Generate new self-signed certificate
openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:2048 -keyout privateKey.key -out certificate.crt
# Generate a new CSR from existing private key
openssl req -out CSR.csr -key privateKey.key -new
# Generate new CSR from certificate (must have private key)
@burhan
burhan / setup.sh
Created May 7, 2020 18:53
Setup some common things on ubuntu
sudo dpkg -i google-chrome-stable_current_amd64.deb && sudo apt install -f
sudo cp pgdg.list /etc/apt/sources.list.d/
ssh-keygen -t rsa -b 4096 -C "burhan.khalid@gmail.com"
sudo apt install -y curl xclip git-core git build-essential vim
sudo apt install -y libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev
sudo apt install -y libffi-dev libgdbm3 libgdbm-dev
git config --global user.email "burhan.khalid@gmail.com"
git config --global user.name "Burhan Khalid"
sudo apt-add-repository ppa:atareao/telegram
sudo apt-add-repository ppa:webupd8team/java
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"globals" :
{
"alwaysShowTabs" : true,
"defaultProfile" : "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
"initialCols" : 120,
"initialRows" : 30,
"keybindings" :
[
@burhan
burhan / time_window.sql
Created April 10, 2019 05:44
time calculation window function stored procedure
create function unjustify_hours(interval)
returns interval
language sql stable
as $f$
select $1 - (extract(day from $1) * interval '1 day')
+ (extract(day from $1) * interval '24 hours');
$f$;
comment on function unjustify_hours(interval) is 'inverse of justify_hours';
create or replace function time_within_window(start_ts timestamp,

Keybase proof

I hereby claim:

  • I am burhan on github.
  • I am burhankhalid (https://keybase.io/burhankhalid) on keybase.
  • I have a public key ASD_YnGT6r8X_WmMnbsOwJdR4NPsaxMLLHOCsmyrbngVNQo

To claim this, I am signing this object:

#!/bin/bash
JQPATH=$(which jq)
if [ "x$JQPATH" == "x" ]; then
echo "Couldn't find jq executable." 1>&2
exit 2
fi
set -eu
shopt -s nullglob
"""
Django settings for sirdab_lab_payment project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
> As part of my project, I need to trigger a functionality after 10
> years.
Assuming 10 years is an arbitrary number and all you really want is to execute something after _X_ time has passed, do the following:
1. Create (and save) the time the program is created, since all calculations will be after this time.
2. In your program start-up/bootstrap logic, load/read the timestamp you saved in step #1, and grab the current time.
3. Compare the difference between the current time and the time that the program is created. If this difference isn't the interval you want, simply exit the program.