Skip to content

Instantly share code, notes, and snippets.

View BdVade's full-sized avatar

Victor Aderibigbe BdVade

  • Nigeria
View GitHub Profile
@judell
judell / jsonb-cte-tutor.md
Last active August 19, 2024 11:11
jsonb-cte-tutor

You are a SQL tutor who helps people write Steampipe queries that involve JSON columns. Such queries can be hard to understand, so we want to provide queries in two forms: concise and expanded.

For example, we want a query to count my gists by language.

Here is the schema for the github_my_gist table

ctx	jsonb		Steampipe context in JSON form, e.g. connection_name.
comments	bigint		The number of comments for the gist.
created_at	timestamp with time zone		The timestamp when the gist was created.
@ARYAN-NIKNEZHAD
ARYAN-NIKNEZHAD / Django_Channels3_Custom_Auth_Middleware.py
Last active September 26, 2024 11:47 — forked from AliRn76/Django_Channels3_Custom_Auth_Middleware.py
Token authorization middleware for Django Channels 3
from django.contrib.auth.models import AnonymousUser
from rest_framework.authtoken.models import Token
from channels.db import database_sync_to_async
from channels.middleware import BaseMiddleware
from project.settings import SIMPLE_JWT, SECRET_KEY
from urllib.parse import parse_qs
import jwt
@database_sync_to_async
def get_user(token_key):
@maximebories
maximebories / convert.md
Last active May 6, 2025 15:49
FFmpeg command to convert webm to mp4 video files

WebM to MP4 using FFmpeg

This FFmpeg command converts a .webm video file to a standard .mp4 file using the libx264 codec for video, aac codec for audio, and a CRF value of 22. The preset is set to 'slow' for higher quality encoding, and the audio bitrate is set to 128 kbps.

If the input and output filenames don't contain spaces, quotation marks or other special characters:

ffmpeg -i input.webm -c:v libx264 -preset slow -crf 22 -c:a aac -b:a 128k output.mp4
@BdVade
BdVade / a16z-crypto-canon.md
Created April 30, 2022 20:38 — forked from arthurgousset/a16z-crypto-canon.md
a16z's Crypto Canon (markdown)
@bpartridge
bpartridge / patch_geos.py
Created December 19, 2021 04:08
Django GEOS patch for macOS arm64
def patch_geos_signatures():
"""
Patch GEOS to function on macOS arm64 and presumably
other odd architectures by ensuring that call signatures
are explicit, and that Django 4 bugfixes are backported.
Should work on Django 2.2+, minimally tested, caveat emptor.
"""
import logging
@xavierfoucrier
xavierfoucrier / gpg-signing.md
Last active April 24, 2025 11:07
GPG signing with Git and Github Desktop

GPG signing – git github-desktop

Here is a short guide that will help you setup your environment to create signed commits or signed tags with Git locally. This has been extensively tested on Windows with Git and the Github Desktop application: I use it every day for my professional development projects.

I you face any issue, feel free to leave a comment below.

Summary

  1. Sign commits or tags
  2. Key passphrase
  3. Disable signatures
  4. Renew a GPG key
@rluts
rluts / token_auth.py
Last active April 10, 2025 16:38
Token authorization middleware for Django Channels 2
from channels.auth import AuthMiddlewareStack
from rest_framework.authtoken.models import Token
from django.contrib.auth.models import AnonymousUser
from django.db import close_old_connections
class TokenAuthMiddleware:
"""
Token authorization middleware for Django Channels 2
"""
@Jonalogy
Jonalogy / handling_multiple_github_accounts.md
Last active May 7, 2025 12:46
Handling Multiple Github Accounts on MacOS

Handling Multiple Github Accounts on MacOS

The only way I've succeeded so far is to employ SSH.

Assuming you are new to this like me, first I'd like to share with you that your Mac has a SSH config file in a .ssh directory. The config file is where you draw relations of your SSH keys to each GitHub (or Bitbucket) account, and all your SSH keys generated are saved into .ssh directory by default. You can navigate to it by running cd ~/.ssh within your terminal, open the config file with any editor, and it should look something like this:

Host *
 AddKeysToAgent yes

> UseKeyChain yes