Skip to content

Instantly share code, notes, and snippets.

@dukechem
dukechem / gist:f25dc3934f23a0097b5cff2d9225ada7
Created Sep 23, 2020
Easy way to get csv list of files with each md5-sum using free TREESIZE.EXE from https://downloads.jam-software.de/filelist/FileList.zip
View gist:f25dc3934f23a0097b5cff2d9225ada7
cd <path to parent folder of the files>
echo "Do not open c:\temp\filelist-with-md5.csv until you see current time displayed"
filelist /md5 > c:\temp\filelist-with-md5.csv
time /t
@dukechem
dukechem / fetch-macos-throttled-resume.py
Last active Jun 19, 2020
Download full macos installers with curl --limit-rate and can resume partial downloads
View fetch-macos-throttled-resume.py
#!/usr/bin/python
# encoding: utf-8
#
# Copyright 2017 Greg Neagle.
# https://github.com/munki/macadmin-scripts/blob/main/installinstallmacos.py
# 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
@dukechem
dukechem / macos-vnc-join-console-session.sh
Created Feb 10, 2020
Fix for no/broken login screen when vnc to remote mojave macos... connects to existing console session I think? See URL for more...
View macos-vnc-join-console-session.sh
sudo defaults write /Library/Preferences/com.apple.RemoteManagement VNCAlwaysStartOnConsole -bool true
# https://apple.stackexchange.com/questions/342161/macos-mojave-remote-access-login-screen-stuck-on-infinite-loading-spinner
@dukechem
dukechem / batch-conv-portfolio-pdf
Created Feb 4, 2020
batch-conv-portfolio-pdf
View batch-conv-portfolio-pdf
Unlike ordinary pdf files, portfolio.pdf files cannot be viewed on tablets or phones, and most software that can open them is available only on windows or mac, not on linux (until recently). They really should have a different extension like .pdfp or similar. Google finds lots of folks looking to batch convert portfolios to individual files, as the portfolio breaks *lots* of automated workflows, especially if you upload them to systems that can't handle them. If you try to open them in other viewers, like a link in a browser, you'll see a misleading messages ending in "get adobe reader now!", like:
http://dev.datalogics.com/cookbook/portfolios/portfolio-sample.pdf
You get that brain-dead message even if you already have adobe-reader. The work-around is to download the pdf then open in some awful adobe-reader or acrobat software (version 10 or newer is needed, I believe).
If you have a bunch of such pdfs, this is a place folder for upcoming script to batch convert portfolio pdf files.
@dukechem
dukechem / rdate-windows-howto.txt
Last active Aug 5, 2020
howto have older windows (not on internet) just get the right date from newer windows on internet. In this example winXP/7/8 uses psrdatesvc to get datetime on private non-internet network without NTP from a windows or linux pc serving RFC868 time (default port 37).
View rdate-windows-howto.txt
In example scenario below, the "XP" box can also be vista/win7-8-8.1 (maybe even 10), 32 or 64 bit.
How to keep XP on minimally on network, but not internet, using network only to update time and push files via scp/sftp.
Both old XP and Server are kept safe by closing all ports on XP, and allow that XP computer to connect only to port 37 on a (rfc868 aka "rdate") time-server. The device providing TIME service on port37 should get its own time from internet/intranet (by ntp, etc).
(The time-server does not have run a server-os: it can be almost any linux device, or even a windows-pc.)
With all ports closed on XP, the time-server cannot infect XP. If XP is infected, such as by a usb-key, it cannot spread over
network to time-server (unless time-server has vulnerability known to virus. Turn off smb1 on time-server (if windows)!
On XP/7/8/8.1, rdatesvc.exe (= prdatesvc = PermaSoft Rdate service) safely keeps system time and date correct by periodically from
port 37 on a specified time SerVeR, such time.nist.go
@dukechem
dukechem / python.rb
Last active Feb 11, 2020 — forked from SamuelMarks/python.rb
python3.6.9 brew formula. Proof of concept that generally fails: brew switch python3 does not really work right: i.e. pip3 fails. Use pyenv/miniconda instead.
View python.rb
class Python < Formula
desc "Interpreted, interactive, object-oriented programming language"
homepage "https://www.python.org/"
url "https://www.python.org/ftp/python/3.6.9/Python-3.6.9.tar.xz"
sha256 "5e2f5f554e3f8f7f0296f7e73d8600c4e9acbaee6b2555b83206edf5153870da"
revision 1
bottle do
sha256 "1bc5a2d3f0a8602bf2f46de7c43fcb6dde4f110c0f4518d4e802cb1f733a43de" => :high_sierra
sha256 "131d39120ac6ca2f21bf231de7414c08916cea472bc5219e0bcb49541f77cb9f" => :sierra
@dukechem
dukechem / csvcol.sh
Last active Feb 10, 2020
csvcol.sh displays how many rows & cols, and shows first 2 rows of csv file(s). Bash/sh script using head, tail, wc, and awk.
View csvcol.sh
#!/bin/bash
if [ $# -eq 0 ]
then
bnam=$(basename "$0")
echo "Usage: $bnam *.csv (displays how many rows & cols, and shows first 2 rows of csv file(s))"; exit
fi
# EXAMPLE OUTPUT
# Total Rows Words Size = 76 76 5587 foobar.csv
# Line 1 has 20 Cols = MW,HBA,HBD,N,O,LOGP,ROTB,TPSA,LOGD,RINGS,ARRINGS,HETRINGS,SYSRINGS,SYSRR,FSP3,NSTEREO,ASA,RELPSA,TC,VWSA
# Line 2 has 20 Cols = 391.43,6,0,4.54,4,71.33,3.22,4,2,4,4,2,2,2,0.27,1,576.35,0.13,-1,538.32
You can’t perform that action at this time.