Skip to content

Instantly share code, notes, and snippets.

@divyajyotiuk
divyajyotiuk / get_twitter_bookmarks.py
Last active February 10, 2024 05:40
Python code to get text and link of the bookmarked tweets and save in markdown
import json
import glob
all_bookmarks = []
md_file = open("bookmarks.md", "w+") # saving in markdown file, if no file exists using '+' creates one
files = [file for file in glob.glob("JSONBookmarks/*")] # using glob to read all files from the folder
for file_name in files:
print(file_name)
with open(file_name) as bk:
@ageis
ageis / certdata2bundle.py
Last active April 28, 2019 12:57
certdata2bundle.py — retrieves Mozilla/NS root trust store, re-encodes DER/base64 as PEM bundle sans metadata
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:set et sw=4:
#
# certdata2bundle.py
# retrieves CA certificates from the Mozilla/NSS root trust store in base64/DER
# format and re-encodes them as a concatenated PEM bundle sans metadata
# writes all CA certificates to /etc/ssl/cacerts.pem
#
# Copyright (C) 2019 Kevin M. Gallagher <kevingallagher@gmail.com>
@cuibonobo
cuibonobo / half-size-booklet.sh
Last active January 24, 2023 20:36
Process a PDF to allow for half-size booklet printing
# Get the number of pages in the PDF. (On a Mac you can do `pages=$(mdls -raw -name kMDItemNumberOfPages $PDF)`)
pages=$(pdftk $PDF dump_data | grep NumberOfPages | awk '{print $2}')
# Get the number of 16-page booklets
booklets=$(($pages/16))
if [[ $(($pages%16)) -gt 0 ]]; then
booklets=$(($booklets+1))
fi
# Determine where to split the book for the half-size
booksplit=$(($booklets/2))
# Determine at what page to split the book