Skip to content

Instantly share code, notes, and snippets.

View canering's full-sized avatar

eg canering

View GitHub Profile
@b0gdanw
b0gdanw / ESD to ISO on macOS.txt
Last active December 22, 2024 06:39
Converting ESD files to ISO images on macOS
ESD to ISO on macOS
https://gist.github.com/b0gdanw/e36ea84828dbd19e03eff6158f1fc77c
Converting ESD files to ISO images on macOS
- download Parallels Desktop 18 for Mac Image from https://www.parallels.com/products/desktop/download/
- at the moment https://download.parallels.com/desktop/v18/18.2.0-53488/ParallelsDesktop-18.2.0-53488.dmg
- open/mount the dmg
- copy prl_esd2iso and libwimlib.1.dylib from /Volumes/Parallels\ Desktop\ 18/Parallels\ Desktop.app/Contents/ to /usr/local/bin/ and /usr/local/lib/
sudo ditto /Volumes/Parallels\ Desktop\ 18/Parallels\ Desktop.app/Contents/MacOS/prl_esd2iso /usr/local/bin/prl_esd2iso
@dmattera
dmattera / man_page_parser.py
Created January 3, 2023 02:31
man_page_parser.py
import os
def parse_man_file(man_filepath):
with open(man_filepath, "r") as man_file:
lines = man_file.read().split("\n")
formatted_lines = []
for line in lines:
# remove Apple developer comments included on the same line and strip off trailing white space
We need to write a react component that will fetch the Reddit homepage and display it and cache it in local storage. If the network is not available it should fetch it from local storage
To create a React component that fetches the Reddit homepage and displays it, you can use the fetch() method to retrieve the data and the useState() hook to store the fetched data in the component's state. Here is an example of how you might implement this:
Copy code
import React, { useState } from 'react';
function RedditHomepage() {
// Use the useState hook to store the fetched data in the component's state
const [data, setData] = useState(null);
@ivan
ivan / saving your tweets with snscrape and SingleFile cli.md
Last active November 29, 2022 13:40
saving your tweets with snscrape and SingleFile cli

Another way to save your own tweets exactly as they are rendered on Twitter, with replies, using snscrape and SingleFile/cli:

  1. TWEETER=someusername
    snscrape twitter-user ${TWEETER} | grep -o -P '\d+$' | sed -r 's,^,https://twitter.com/i/status/,g' > ${TWEETER}-tweets # write a URL list
    
  2. Make sure the oldest tweet in this list is in fact your oldest tweet, and that snscrape did not stop early due to Twitter Search problems.
  3. Merge in all the tweet URLs from your Twitter data export, to include retweets and Circle tweets:
    cat data/tweets.js | sed -r 's/^window\.YTD\.tweets\.part0 = //' | jq -r '.[].tweet.id' | sed -r 's,^,https://twitter.com/i/status/,g' >> ${TWEETER}-tweets
    
@PicoMitchell
PicoMitchell / man2pdf.sh
Last active November 30, 2024 08:10
Display "man" pages as PDFs on macOS, with nice filenames and caching.
#!/bin/sh
man2pdf() {
##
## Created by Pico Mitchell (of Random Applications) on 11/16/22
##
## https://gist.github.com/PicoMitchell/619c12fd6a53ae6ec657514915d4edf9
##
## MIT License
##
@joeybaumgartner
joeybaumgartner / man2pdf.sh
Last active December 21, 2023 06:23
Script for opening PDF documents in Preview on macOS Ventura and newer.
#!/bin/sh
if [ $# -lt 1 ]
then
echo “man2pdf [man page name]”
exit
fi
tempfoo=`basename $0`
TMPPDFFILE=`mktemp /tmp/${tempfoo}.XXXXXX` || exit 1
@maxloncar
maxloncar / .zshrc
Last active May 1, 2023 20:00
Setting to display in which architecture we are currently in
if [ "$(uname -p)" = "intel" ]; then
echo "Running in intel arch (Rosetta)"
eval "$(/usr/local/homebrew/bin/brew shellenv)"
alias brew='/usr/local/homebrew/bin/brew'
else
echo "Running in ARM arch"
eval "$(/opt/homebrew/bin/brew shellenv)"
alias brew='/opt/homebrew/bin/brew'
fi
@maxloncar
maxloncar / .zshrc
Last active May 1, 2023 20:02
Example of brew aliases
alias rbrew="arch -x86_64 brew"
alias ibrew='arch --x86_64 /usr/local/Homebrew/bin/brew'
@rtrouton
rtrouton / pkg_cheatsheet.md
Created November 14, 2022 22:00
Working with Apple pkgs

Mac Packaging Cheatsheet

Create a component pkg from a DMG

pkgbuild --component /Volumes/ApplicationName/*.app --install-location \
    /Applications ApplicationName-Version.pkg

Install pkg from command line

@b0gdanw
b0gdanw / Disable-Ventura-Bloatware.sh
Last active April 25, 2025 22:12
Disable Ventura Bloatware
#!/bin/zsh
# Credit: Original idea and script disable.sh by pwnsdx https://gist.github.com/pwnsdx/d87b034c4c0210b988040ad2f85a68d3
# Disabling unwanted services on macOS Big Sur (11), macOS Monterey (12) and macOS Ventura (13)
# Disabling SIP is required ("csrutil disable" from Terminal in Recovery)
# Modifications are written in /private/var/db/com.apple.xpc.launchd/ disabled.plist, disabled.501.plist
# To revert, delete /private/var/db/com.apple.xpc.launchd/ disabled.plist and disabled.501.plist and reboot; sudo rm -r /private/var/db/com.apple.xpc.launchd/*
# user