Skip to content

Instantly share code, notes, and snippets.

@mesgarpour
mesgarpour / appsScript_ListFilesFolders_ver.2.js
Last active March 8, 2025 03:52
[Google Apps Script] List all files & folders in a Google Drive folder, & write into a speadsheet
/*
* Copyright 2017 Mohsen Mesgarpour
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@nuomi1
nuomi1 / PrintBootCampESDInfo.swift
Last active March 28, 2025 20:13
macOS and BootCamp Latest
#!/usr/bin/env swift
//
// PrintBootCampESDInfo.swift
//
// Created by nuomi1 on 8/5/18.
// Copyright © 2018年 nuomi1. All rights reserved.
//
import Foundation
@NSExceptional
NSExceptional / Private class usage in Swift.md
Last active September 25, 2024 21:53
An example of how to use a private class from Swift. It's not pretty, but it isn't too bad.

Using private Objective-C classes from Swift

In Objective-C, if you want to make use of one of Apple's internal classes, all you have to do is declare the class's interface with the methods you want to use. From there you can create instances of the class by using the NSClassFromString function to obtain a reference to the class object, like so:

[[NSClassFromString(@"_NSSomeClass") alloc] initWithFoo:5]

In Swift, this is not so easy. Referencing the type of the "hollow" Objective-C class interface anywhere in Swift code makes the compiler query the class for type information that is not known at compile time. This presents a huge problem. You cannot dynamically initialize a type either. Though, it seems the following code used to work at one point:

@adamhooper
adamhooper / mbox_to_overview_folder.py
Last active September 10, 2023 21:13
Convert an mbox file into a folder full of .txt and attachments. Good for uploading ~1,000 messages to Overview.
#!/usr/bin/env python3
import email.message
import mailbox
# Just ignore these lines.
# Python's mbox reader finds a way to return Messages that don't
# have these super-important methods. This hack adds them.
setattr(email.message.Message, '_find_body', email.message.MIMEPart._find_body)
setattr(email.message.Message, '_body_types', email.message.MIMEPart._body_types)
@tripflex
tripflex / post.sh
Created February 23, 2017 04:38
Plex DVR Post Process remove Commercials with Comskip
#!/bin/csh
# Add bash path to Plex path.
set path = ($path /usr/local/bin)
# Sleep for a pseudorandom period (up to 10 seconds) to limit the number of instances that start at once
sleep `echo $$%10 | bc`
/root/comchap/comcut --ffmpeg=/usr/local/bin/ffmpeg --comskip=/root/comskip/comskip --lockfile=/tmp/comchap.lock --comskip-ini=/usr/local/etc/comskip.ini "$1"
HandBrakeCLI -i "$1" -o "$1".mkv --format mkv --encoder x264 --quality 20 --loose-anamorphic --decomb fast --x264-preset fast --h264-profile high --h264-level 4.1
find /mnt -name "*.ts" -not -path "*/\.*" -delete
@Kovrinic
Kovrinic / .gitconfig
Last active April 15, 2025 02:31
git global url insteadOf setup
# one or the other, NOT both
[url "https://github"]
insteadOf = git://github
# or
[url "[email protected]:"]
insteadOf = git://github
@rowanphipps
rowanphipps / macOS_rEFInd_guide.md
Created August 10, 2017 17:53
A guide to using rEFInd on macOS

A Guide to Multibooting a Mac

Disclaimer: This has the potential to destroy all the data on your drive. Make sure you have adequate (and verified working) backups before you proceed. You have been warned!

That being said this should leave all of your data untouched.

Background:

I have a mid-2012 15” non-Retina Mac book pro with a 1TB hard drive. I decided that I wanted to make my system faster by replacing the hard drive with an ssd and while I was at it I decided I also wanted to have Windows and Ubuntu partitions. Doing it this way meant that I had no data on the SSD while I experimented with partitions and boot managers although everything I did should be possible on a drive with an existing system.

Goals:

  • Multiple OSs installed with the ability to add more
@AveYo
AveYo / .. MediaCreationTool.bat ..md
Last active March 26, 2025 17:03
Universal MediaCreationTool wrapper for all MCT Windows 10 versions - MOVED TO github.com/AveYo/MediaCreationTool.bat
@unity
unity / main.yml
Last active June 17, 2022 08:17
Homeassistant-ansible
#########################################################################
# Title: Cloudbox: Homeassistant Role #
# Author(s): l3uddz, desimaniac #
# URL: https://github.com/cloudbox/cloudbox #
# Docker Image: homeassistant/home-assistant #
# -- #
# Part of the Cloudbox project: https://cloudbox.works #
#########################################################################
# GNU General Public License v3.0 #
#########################################################################
@slayer
slayer / cloudflare-delete-all-records.sh
Last active January 30, 2025 11:44
Delete all DNS records for specified zone
#!/bin/bash
TOKEN="xxxxxxxxxxxxxxxxxxx"
ZONE_ID=2222222222222222222222222
# [email protected]
# KEY=11111111111111111111111111
# Replace with
# -H "X-Auth-Email: ${EMAIL}" \
# -H "X-Auth-Key: ${KEY}" \