Skip to content

Instantly share code, notes, and snippets.

@toolness
toolness / adventures-in-python-core-dumping.md
Last active April 28, 2025 20:44
Adventures in Python Core Dumping

Adventures in Python Core Dumping

After watching Bryan Cantrill's presentation on [Running Aground: Debugging Docker in Production][aground] I got all excited (and strangely nostalgic) about the possibility of core-dumping server-side Python apps whenever they go awry. This would theoretically allow me to fully inspect the state of the program at the point it exploded, rather than relying solely on the information of a stack trace.

@babldev
babldev / decode_flask_cookie.py
Last active December 15, 2023 12:02
Decode a Flask Session cookie, given the cookie and secret key
@thomasdarimont
thomasdarimont / readme.md
Last active June 14, 2025 09:41
Example for decoding a JWT Payload with your Shell (bash, zsh...)

Setup

Add this to your .profile, .bashrc, .zshrc...

decode_base64_url() {
  local len=$((${#1} % 4))
  local result="$1"
  if [ $len -eq 2 ]; then result="$1"'=='
  elif [ $len -eq 3 ]; then result="$1"'=' 
  fi
 echo "$result" | tr '_-' '/+' | openssl enc -d -base64
import asyncio
loop = asyncio.get_event_loop()
async def hello():
await asyncio.sleep(3)
print('Hello!')
if __name__ == '__main__':
loop.run_until_complete(hello())
@tasdikrahman
tasdikrahman / irssi.md
Last active April 24, 2025 18:53
irssi cheatsheet
@SheldonWangRJT
SheldonWangRJT / Convert .mov or .MP4 to .gif.md
Last active July 8, 2025 05:06
Convert Movie(.mov) file to Gif(.gif) file in one command line in Mac Terminal

This notes is written by Sheldon. You can find me with #iOSBySheldon in Github, Youtube, Facebook, etc.

Need

Convert .mov/.MP4 to .gif

Reason

As a developer, I feel better to upload a short video when I create the pull request to show other viewers what I did in this PR. I tried .mov format directly got after finishing recording screen using Quicktime, however, gif offers preview in most web pages, and has smaller file size.

This is not limited to developer, anyone has this need can use this method to convert the files.

@ibraheem4
ibraheem4 / postgres-brew.md
Last active July 11, 2025 10:31 — forked from sgnl/postgres-brew.md
Installing Postgres via Brew (OSX)

Installing Postgres via Brew

Pre-Reqs

Brew Package Manager

In your command-line run the following commands:

  1. brew doctor
  2. brew update
(function(){
let arr = document.getElementsByTagName("a");
let arrL = arr.length;
for(let i=0; i<arrL; i++){
arr[i].removeAttribute("data-lynx-uri");
}
})();
@coolreader18
coolreader18 / segfault.py
Last active March 30, 2024 08:05
CPython segfault in 5 lines of code
class E(BaseException):
def __new__(cls, *args, **kwargs):
return cls
def a(): yield
a().throw(E)
@kendallroth
kendallroth / ignore_diffs.md
Created January 24, 2022 17:43
Exclude files from Gid diff

Some projects may have files that should be skipped in Git diff but still show in Git status (and be tracked). This can be made possible with a custom diff driver that uses a no-op command.

Adapted from StackOverflow - @KurzedMetal.

Custom diff driver

Create a global no-op diff command driver with the following command. Note that driver can be limited to local respository by removing the --global flag.

git config diff.nodiff.command /bin/true