Skip to content

Instantly share code, notes, and snippets.

View stevekm's full-sized avatar

Stephen Kelly stevekm

View GitHub Profile
@stevekm
stevekm / launchctl_man.md
Last active March 30, 2024 20:02
macOS OS X login items

[source]

This manual page is for Mac OS X version 10.9

If you are running a different version of Mac OS X, view the documentation locally:

    In Terminal, using the man(1) command

Reading manual pages
@stevekm
stevekm / extract_flac2mp3.sh
Last active April 17, 2017 17:37
Extract archives and convert FLAC's to mp3 on OS X / macOS
#!/bin/bash
input_dir="$1"
printf "Input dir is:\n%s\n\n" "$input_dir"
# this script will extract all of the archive files it finds with p7zip
# first install p7zip
# brew install p7zip
@stevekm
stevekm / counter.md
Last active March 23, 2017 01:50
bash for loop with sleep counter

After every third item, sleep [source]

counter=0
limit=3

foo="thing1 thing2 thing34 thing4 thing5 thing6 thing7 thing8 thing9 thing9"
for thing in $foo; do
    ( # start a subshell
 # increment the counter, sleep & reset it if its over the limit
@stevekm
stevekm / ssh.md
Last active March 22, 2017 23:17
SSH login without password

[source]

SSH login without password

Your aim

You want to use Linux and OpenSSH to automate your tasks. Therefore you need an automatic login from host A / user a to Host B / user b. You don't want to enter any passwords, because you want to call ssh from a within a shell script.

How to do it

First log in on A as user a and generate a pair of authentication keys. Do not enter a passphrase:

@stevekm
stevekm / default_sftp.txt
Last active February 24, 2017 20:03
Atom SFTP config settings from https://atom.io/packages/Remote-FTP
{
"protocol": "sftp",
"host": "example.com",
"port": 22,
"user": "user",
"pass": "pass",
"promptForPass": false,
"remote": "/",
"local": "",
"agent": "",
@stevekm
stevekm / GoogleHome_need.md
Created February 9, 2017 16:55
Things I wish Google Home could do better; things I've asked Google home and did not get a good answer for, or actions which weren't supported
  • "Where did you find this song?"
  • "What playlists do I have?"
  • "Is this song from Play Music or Pandora?"
@stevekm
stevekm / blob2sqlite.md
Last active September 28, 2021 14:55
Store a binary blob file in a SQLite database to get around email filters

Sometimes the email filter at work tries to prevent you from sending certain files so you can use this method to get around it. For example, .app files, or executables, or installers.

tested with OS X and macOS, should work with any system with SQLite and bash installed

store the binary file as a blob in a SQLite database and then the reciepient can extract it.

Sender: add the file to db

my_file="iStat.app"
@stevekm
stevekm / gist:c29344cd1b66b422b907e2f4cdf41756
Created February 3, 2017 01:30 — forked from brentp/gist:819611
install annovar and use it to annotate a vcf with hg19
wget http://www.openbioinformatics.org/annovar/download/annovar.latest.tar.gz.mirror
tar xzvf annovar.tar.gz
cd annovar
# download databases (goes to UCSC)
./annotate_variation.pl -buildver hg19 -downdb 1000g2010nov humandb
./annotate_variation.pl -buildver hg19 -downdb avsift humandb
./annotate_variation.pl -buildver hg19 -downdb refGene humandb
./annotate_variation.pl -buildver hg19 -downdb mce46way humandb/
./annotate_variation.pl -buildver hg19 -downdb snp131 humandb/
@stevekm
stevekm / showfiles.md
Created January 6, 2017 21:56
Show hidden files in OS X macOS Finder using Terminal command to change settings
$ defaults write com.apple.finder AppleShowAllFiles YES
$ killall Finder
@stevekm
stevekm / date.md
Created January 3, 2017 03:37
return ISO compliant timestamp from file modification time datetime
>>> import os
>>> import datetime
>>> file = "my_file.txt"
>>> os.stat(file).st_ctime
1483323862.8774118
>>> os.path.getmtime(file)
1483323862.873167
>>> os.path.getmtime(os.path.getmtime(file))
KeyboardInterrupt