Skip to content

Instantly share code, notes, and snippets.

View stevekm's full-sized avatar

Stephen Kelly stevekm

View GitHub Profile
@stevekm
stevekm / blob2sqlite.md
Last active July 2, 2024 20:42
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 / RIP.md
Last active May 31, 2025 03:56
remove Sophos from OS X El Capitan, and jamf

Sophos

with Tamper Protection on you cannot normally remove the software, and a password is needed to disable Tamper Protection. However you can also disable it this way

with Tamper protection enabled

/Library/Application Support/Sophos/opm/Installer.app/Contents$ sudo ./MacOS/tools/InstallationDeployer --remove
Password:
Tamper protection check failed. Exiting.
@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
@stevekm
stevekm / stuff.md
Last active May 24, 2017 16:12
New MacBook setup essentials guide

Homebrew

# paste of some of the things I've installed

brew install python
brew install pip
brew install pyenv
brew install pip --upgrade
@stevekm
stevekm / sublime.txt
Last active November 18, 2017 00:10
My user settings for Sublime Text Editor. More settings here: http://docs.sublimetext.info/en/latest/reference/settings.html
{
"color_scheme": "Packages/Monokai Extended/Monokai Extended.tmTheme",
"draw_white_space": "all",
"font_size": 18,
"ignored_packages":
[
"Vintage"
],
"ignored_words":
[
@stevekm
stevekm / session.md
Last active November 30, 2016 18:28
R system session information code chunk for reports

The codes:

# system info
system("uname -srv", intern = TRUE)

# dir
system('pwd',intern=T)

# date time
@stevekm
stevekm / pyshell.md
Last active March 10, 2024 14:49
Start an interactive Python shell session from within a script

from here: http://stackoverflow.com/questions/5597836/embed-create-an-interactive-python-shell-inside-a-python-program

paste this inside your script for debugging, to start a Python interactive terminal shell session at that point in the script, super useful for debugging since it lets you explore the Python environment and access objects and variables as they are at that point in the script.

import readline # optional, will allow Up/Down/History in the console
import code
vars = globals().copy()
vars.update(locals())
@stevekm
stevekm / ssh_server_commands.md
Last active December 4, 2023 15:02
handy ssh, rsync, scp commands

Here are some handy commands for connecting to servers and copying files about. These are all for Linux terminal / bash shell

Do cool things with ssh; log in & run command, find files in dir

# log into server
ssh [email protected] -Y 
# -X      Enables X11 forwarding. <- use this to enable X11 graphical windows, but this will eventually time out & you'll lose the X11 connection
# -Y      Enables trusted X11 forwarding. <- this one preserves your X11 connection while you're logged in