Skip to content

Instantly share code, notes, and snippets.

:atom:
Thinking

Jacob Salmela jacobsalmela

:atom:
Thinking
Block or report user

Report or block jacobsalmela

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jacobsalmela
jacobsalmela / setFavServers.sh
Created Mar 9, 2015
Add unlimited servers to the Connect To... menu in OS X
View setFavServers.sh
#!/bin/bash
bud='/usr/libexec/Plistbuddy'
plist=$HOME'/Library/Preferences/com.apple.sidebarlists.plist'
servers=('afp://servername'
'smb://servername'
'vnc://servername'
'ftp://servername')
killall cfprefsd
@jacobsalmela
jacobsalmela / mergePDFs.py
Last active Dec 18, 2019
Merge PDFs using Python
View mergePDFs.py
#!/usr/bin/env python
# Jacob Salmela
# Make PyPDF2 is installed: sudo easy_install PyPDF2
import sys
import os
from PyPDF2 import PdfFileMerger, PdfFileReader
merger = PdfFileMerger()
# Get the folder of the first file and that's where the merged PDF will go
@jacobsalmela
jacobsalmela / ssh-in-single-user-mode.sh
Created May 13, 2014
Enables outbound SSH in Single-user Mode on OS X
View ssh-in-single-user-mode.sh
#!/bin/bash
# https://github.com/jacobsalmela
# Enables outbound SSH in single-user mode on OS X
# Save this file as /var/root/.profile and boot into single-user mode
# Last tested on 10.9.2
#----------VARIABLES---------
# Manually set ethernet device ID
@jacobsalmela
jacobsalmela / autoDeployWindows.bat
Last active Nov 26, 2019
Script for WinPE to auto deploy a Windows 10 image.
View autoDeployWindows.bat
echo select disk 0 > diskpart%ID%.txt
echo clean >> diskpart%ID%.txt
echo ** Creating system reserved partition...
echo create partition primary size=500 >> diskpart%ID%.txt
echo select partition 1 >> diskpart%ID%.txt
echo active >> diskpart%ID%.txt
echo format quick fs=ntfs >> diskpart%ID%.txt
echo assign letter="r" >> diskpart%ID%.txt
@jacobsalmela
jacobsalmela / app-store-pkgs.sh
Created Dec 30, 2014
Save App Store downloads as .pkgs
View app-store-pkgs.sh
#!/bin/bash
appStoreFolder=$(sudo find /private/var/folders -type f -name "*.pkg")
i=0
for package in $appStoreFolder
do
sudo ln $package ~/Downloads/_MAS_$i.pkg
i=$(($i+1))
done
@jacobsalmela
jacobsalmela / convertDOCXtoPDF.sh
Created Mar 12, 2016
Converts a DOC or DOCX to a PDF with a right-click
View convertDOCXtoPDF.sh
#!/bin/bash
# Jacob Salmela
# 2016-03-12
# Convert annoying DOCX into PDFs with a right-click
# Run this as an Automator Service
###### SCRIPT #######
for f in "$@"
do
# Get the full file PATH without the extension
@jacobsalmela
jacobsalmela / unshare_all_printers.sh
Last active Nov 19, 2018 — forked from rmanly/unshare_all_printers.bash
Unshares printers and disables Printer Sharing
View unshare_all_printers.sh
#!/bin/bash
#while read -r _ _ printer _; do
# /usr/sbin/lpadmin -p "${printer/:}" -o printer-is-shared=false
#done < <(/usr/bin/lpstat -v)
# Slightly faster when there are a lot of printers
lpstat -p | grep printer | cut -d" " -f2 | xargs -I{} lpadmin -p {} -o printer-is-shared=false
# Also disable Printer Sharing in the Sharing pane
cupsctl --no-share-printers
@jacobsalmela
jacobsalmela / osx-set-all-names.sh
Created Jan 12, 2015
Set all four OS X computer names using a script.
View osx-set-all-names.sh
#!/bin/bash
# Bonjour name ending in .local
scutil --set LocalHostName "My-iMac"
# Friendly name shown in System Preferences > Sharing
scutil --set ComputerName "My-iMac"
# The name recognized by the hostname command
scutil --set HostName "My-iMac"
# Save the computer's serial number in a variable so it can be used in the next command.
serialNum=$(ioreg -l | awk '/IOPlatformSerialNumber/ { split($0, line, "\""); printf("%s\n", line[4]); }')
# Set the NetBIOS name as the serial number
@jacobsalmela
jacobsalmela / requestMedicalRecords.py
Created Jun 3, 2016
Template script to quickly fill out PDFs
View requestMedicalRecords.py
#!/usr/bin/env python
# Jacob Salmela
# 2016-06-02
# Writes text to a PDF at coordinates. Use for quickly filling out forms that you use regularly.
# This takes some manual setup, but saves a ton of time once done
# http://stackoverflow.com/a/17538003
# Make sure to install the two utilities below first
# sudo easy_install pyPdf
# sudo easy_install reportlab
View winpeDeployWindows10
@ECHO OFF
:: Jacob Salmela
:: 2016-03-09
:: Deploy Windows 10
wpeinit
echo ** Selecting first disk and reformatting...
echo select disk 0 > diskpart%ID%.txt
echo clean >> diskpart%ID%.txt
You can’t perform that action at this time.