Skip to content

Instantly share code, notes, and snippets.

View robert-claypool's full-sized avatar
💥
Breaking Things

Robert Claypool robert-claypool

💥
Breaking Things
View GitHub Profile
@robert-claypool
robert-claypool / gist:3d6ca2af08679bb3a3cb
Created August 7, 2014 19:56
onename.io Identity Verification
Verifying myself: My Bitcoin username is +robert_claypool. https://onename.io/robert_claypool
@robert-claypool
robert-claypool / domain-user-as-sysadmin.sql
Created August 22, 2014 21:22
How to Add a Windows Domain User to SQL Server as ‘sysadmin’
USE master
GO
CREATE LOGIN [domain\username] FROM WINDOWS WITH DEFAULT_DATABASE = [Master]
GO
EXEC sp_addsrvrolemember @loginame=N'domain\username', @rolename=N'sysadmin'
GO
@robert-claypool
robert-claypool / gpg-message-encryption.ps1
Created August 22, 2014 21:24
A Windows command line example for gpg message encryption
# A Windows command line example for gpg message encryption:
# Install Gpg4win to use gpg.
# Gpg4win is a email and file encryption package for Windows that includes the open source Gnu Privacy Guard.
# It implements the OpenPGP standard and is widely used to sign, verify, encrypt, and decrypt data.
# http://www.gpg4win.org/
echo "Hi John," "Here's your login info:" "username=admin" "password=2d!5-e.6:A~77/Vq" | gpg --encrypt --sign --armor -r john.doe@example.com --output c:\temp\message.txt
@robert-claypool
robert-claypool / p4merge-git-config
Last active August 29, 2015 14:22
A typical P4Merge Git configuration
git config --global mergetool.p4merge.path 'c:\path-to\p4merge.exe'
git config --global merge.tool p4merge
git config --global difftool.p4merge.path 'c:\path-to\p4merge.exe'
git config --global diff.tool p4merge
@robert-claypool
robert-claypool / ssh-keys-management-advice
Last active August 29, 2015 14:23
SSH keys management advice
Use separate private keys *per origin* (e.g. one from your work computer and a separate one for your personal laptop).
The same is not true of destinations: One private key on your personal laptop can serve to access multiple destinations;
if that key is compromised, all other private keys stored on in the same directory will surely be compromised as well.
-- http://superuser.com/a/189485/13481
@robert-claypool
robert-claypool / sha1-digest-calculation.py
Last active August 23, 2020 21:28
SHA1 digest calculation using Python's hashlib
import hashlib
print hashlib.sha1(open("c:\\temp\\my.file", "rb").read()).hexdigest()
@robert-claypool
robert-claypool / file-size-in-bytes.py
Last active June 13, 2018 03:11
File size calculation in Python
import os
print os.path.getsize("c:\\temp\\my.file") # returns the size in bytes
@robert-claypool
robert-claypool / dd2webmercator.py
Last active September 27, 2022 16:02
Convert bounding box values from decimal degrees to Web Mercator (Auxiliary Sphere) EPSG:3857
# This script converts bounding box values from decimal degrees to
# WGS 1984 Web Mercator (Auxiliary Sphere) EPSG:3857. Note that Web Mercator
# was originally assigned wkid 102100, but was later changed to 3857.
# See http://resources.arcgis.com/en/help/rest/apiref/geometry.html
# Arguments and Output
# With flags, arguments can be given in any order, but the output will always
# be ordered like a GeoJSON bbox: "xmin, ymin, xmax, ymax". In both the GeoJSON and
# Esri JSON specs, a bounding box (or envelope) is defined with the lowest
# values for all axes followed by the highest values, e.g. "xmin, ymin, xmax, ymax".
@robert-claypool
robert-claypool / notes-on-Vim.md
Last active January 15, 2016 07:12
My notes on Vim

My notes on Vim

  • Where is this Vim installed? Within Vim, run :echo $VIM
  • The home directory is $HOME. Within Vim, enter :echo $HOME or :echo ~
  • A history of Vim commands is in $HOME/_viminfo. Within Vim, enter : and then and to cycle through history
  • :scriptnames lists files that Vim loaded for you, including your .vimrc file
  • .vimrc is not created for you by most installations. Create one and save it in $HOME
  • To edit your configuration in Vim, enter :e $HOME/.vimrc or :e ~/.vimrc (tilde is an alias of HOME)
  • The Vim installed as part of msysgit does not have syntax files for most languages. To fix this, install Vim for Windows (gvim) and copy syntax files over from one installation to the other, e.g. ~\Program Files (x86)\Vim\vim74\syntax -- to --> ~\Program Files (x86)\Git\share\vim\vim74\syntax. Another option is to go into ~\Program Files (x86)\Git\bin\ and edit the vim and vi files to run your gvim installation of Vim instead.
  • Git for Windows (msysgit
@robert-claypool
robert-claypool / app_offline.htm
Created July 21, 2015 20:11
A simple "app offline" template for ASP.NET
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Offline</title>
</head>
<body style="margin:3em;font-family:sans-serif">
<h2>Offline</h2>
<p>This site is offline for maintenance.</p>
<!--