Skip to content

Instantly share code, notes, and snippets.

View pa-0's full-sized avatar

Peter Abbasi pa-0

View GitHub Profile
@pa-0
pa-0 / GPG and git on macOS.md
Last active January 24, 2025 01:09 — forked from danieleggert/GPG and git on macOS.md
How to set up git to use the GPG Suite

GPG and git on macOS

Setup

No need for homebrew or anything like that. Works with https://www.git-tower.com and the command line.

  1. Install https://gpgtools.org -- I'd suggest to do a customized install and deselect GPGMail.
  2. Create or import a key -- see below for https://keybase.io
  3. Run gpg --list-secret-keys and look for sec, use the key ID for the next step
  4. Configure git to use GPG -- replace the key with the one from gpg --list-secret-keys
@pa-0
pa-0 / .cleanup.sh
Created January 22, 2025 07:33 — forked from ivanistheone/.cleanup.sh
A shell script I use to (mostly) automatically cleanup my ~/Desktop
#!/bin/bash
MYHOME=$HOME
MYDESKTOP=$HOME/Desktop
echo " _ "
echo " | | "
echo " ___ | | ___ __ _ _ __ _ _ _ __ "
echo " / __|| |/ _ \/ _ | '_ \| | | | '_ \ "
echo " | (__ | | __/ (_| | | | | |_| | |_) |"
echo " \___||_|\___|\__,_|_| |_|\__,_| .__/ "
@pa-0
pa-0 / gen.sh
Created January 22, 2025 07:30 — forked from rmorey/gen.sh
List of Uniform Type Identifiers
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -dump | grep uti: | cut -c 29- | sort | uniq > utis.txt
@pa-0
pa-0 / Free O'Reilly Books.md
Last active January 21, 2025 05:10 — forked from augbog/Free O'Reilly Books.md
Free O'Reilly Books

Free O'Reilly books and convenient script to just download them.

Thanks /u/FallenAege/ and /u/ShPavel/ from this Reddit post

How to use:

  1. Take the download.sh file and put it into a directory where you want the files to be saved.
  2. cd into the directory and make sure that it has executable permissions (chmod +x download.sh should do it)
  3. Run ./download.sh and wee there it goes. Also if you do not want all the files, just simply comment the ones you do not want.
@pa-0
pa-0 / com.apple.ibooks.display-options.xml
Created January 20, 2025 04:28 — forked from arthurattwell/com.apple.ibooks.display-options.xml
Apple iBooks display options file for META-INF folder in .epub – basic settings
<?xml version="1.0" encoding="UTF-8"?>
<display_options>
<platform name="*">
<option name="specified-fonts">true</option>
<option name="interactive">false</option>
<option name="fixed-layout">false</option>
<option name="open-to-spread">false</option>
<option name="orientation-lock">none</option>
</platform>
</display_options>
@pa-0
pa-0 / pandoc.css
Created January 18, 2025 05:02 — forked from SecT0uch/pandoc.css
Add this to your Pandoc HTML documents using `-H pandoc.css` to make them look more awesome. (Integrated in HTML)
<style type="text/css">
/*
* I add this to html files generated with pandoc.
*/
html {
font-size: 100%;
overflow-y: scroll;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
@pa-0
pa-0 / header.html
Created January 18, 2025 05:00 — forked from lpenaud/header.html
Add style to pandoc HTML render.
<script type="module">
import mermaid from 'https://cdn.jsdelivr.net/npm/[email protected]/dist/mermaid.esm.min.mjs';
mermaid.initialize({ startOnLoad: false });
await mermaid.run({
nodes: document.querySelectorAll('pre.mermaid > code:first-child'),
});
function findMermaidSvg(child) {
if (child.tagName === "A" || child.tagName === "BUTTON") {
return null;
@pa-0
pa-0 / submit_form.js
Created January 18, 2025 01:00 — forked from asfaltboy/submit_form.js
generic form submission over ajax with jsonp response
$('#form').submit(function() {
payload = $(this).serialize();
$.ajax({
url: 'http://',
type: 'POST',
data: payload,
dataType: 'jsonp'
success: function(data){
// present success message here
}
@pa-0
pa-0 / organize-books.sh
Created January 17, 2025 05:26 — forked from rkitover/organize-books.sh
organize book collection by two letter prefix
#!/bin/sh
for dir in *; do cd "$dir"; find . -maxdepth 1 -not -name . | awk '{ letters=toupper($0); gsub("[^A-Z]", "", letters); print $0 "|" dir substr(letters, index(letters, dir) + 1, 1) }' dir="$dir" | while IFS='|' read book subdir; do [ -d "$subdir" ] || mkdir "$subdir"; mv "$book" "$subdir"; done; cd ..; done
# alternately, with GNU sed instead of awk:
# for dir in *; do cd "$dir"; find . -maxdepth 1 -not -name . | gsed 'h; s/[^A-Za-z]//g; s/^\(.*\)$/\U\1/; s/^[^'$dir']*'$dir'\(.\).*/'$dir'\1/; H; g; s/\n/|/' | while IFS='|' read book subdir; do [ -d "$subdir" ] || mkdir "$subdir"; mv "$book" "$subdir"; done; cd ..; done
@pa-0
pa-0 / fix-packt-epubs.sh
Created January 17, 2025 05:26 — forked from thsutton/fix-packt-epubs.sh
Shell script to fix the "unique" identifiers in EPUB files sold by Packt Publishing.
#!/bin/sh
#
# fixpacktepubs.sh
#
# Process the EPUB files in the current directory and recreate them with the
# ISBN as the unique value. This script was written because Packt Publishing
# sell EPUBs with non-unique unique identifiers and it assumes that the EPUBs
# being process are structured like Packt's.
#