Skip to content

Instantly share code, notes, and snippets.

View johnrc's full-sized avatar

John Cragun johnrc

View GitHub Profile
@johnrc
johnrc / python_scraper.py
Last active August 29, 2015 14:10
Scrape melskitchencafe.com for recipes
# Before running this script, install requests, beautifulsoup4
import requests as req
from bs4 import BeautifulSoup
url = "http://www.melskitchencafe.com/vanilla-buttermilk-cupcakes-and-fantastic-easy-buttercream-frosting/"
html = req.get(url)
soup = BeautifulSoup(html.text)
print "This is a recipe for: "
@johnrc
johnrc / gist:956d3ba78d4539caf3a3
Last active August 29, 2015 14:15
Basic Apache virtual host configuration
# http://www.rackspace.com/knowledge_center/article/how-to-serve-multiple-domains-using-virtual-hosts
# Uncomment this line from /etc/httpd/conf/httpd.conf
NameVirtualHost *:80
# Create multiple files for each vhost or put them all in one
# They just need to be named with *.conf to be picked up
<VirtualHost *:80>
ServerName example.org
ServerAlias *.example.org
ServerAdmin webmaster@example.org
@johnrc
johnrc / mac_bootable_drive.sh
Created March 26, 2015 01:20
Command to create bootable Mac OS X installer
#!/usr/bin/env bash
# Must run as sudo and assumes the following:
# 1. your drive has been formatted with the name of "Untitled"
# 2. you've downloaded Yosemite from Apple store
/Applications/Install\ OS\ X\ Yosemite.app/Contents/Resources/createinstallmedia \
--volume /Volumes/Untitled \
--applicationpath /Applications/Install\ OS\ X\ Yosemite.app
--nointeraction
@johnrc
johnrc / remote_access.ps1
Last active April 12, 2017 14:30
Powershell commands to remote access a computer
# Get credentials for the box
$credentials = (Get-Credential)
# If above doesn't work do
$password = ConvertTo-SecureString "password" -AsPlainText -Force
$credentials = New-Object System.Management.Automation.PSCredential ("username", $password)
Enter-PSSession -ComputerName <computername> -Credential $credentials
# Remove an item
@johnrc
johnrc / youtube-dl.md
Last active August 29, 2015 14:19
Youtube downloader

How to install

pip install youtube-dl

To download best quality

List the formats available:

youtube-dl -F <youtube url>

Download a specific format based on a number above

@johnrc
johnrc / mac-R-install.R
Created May 11, 2015 16:55
Install R packages on Mac
# You can add the options command to ~/.Rprofile
# By setting the pkgType to mac.binary, it'll use the packages
# in http://cran.r-project.org/bin/macosx/contrib/3.x
options(pkgType="mac.binary", repos="http://cran.company.com")
install.packages(c("acepack", "Rcpp"))
@johnrc
johnrc / eclipse-marketplace-proxy.md
Last active August 29, 2015 14:21
Eclipse marketplace through proxy

Eclipse Marketplace through Proxy

Note this bug if you keep getting disconnected.

You may need to increase the read timed out as explained here.

@johnrc
johnrc / git-fundamentals.md
Last active September 1, 2015 21:42
Git Fundamentals

Setup Git

3 locations for settings files

  • System settings in /etc/gitconfig
  • User settings in ~/.gitconfig
  • Project settings in project/.git/config

Determine what you already have set with

git config --global --list

@johnrc
johnrc / npm-publish-tips.md
Last active February 4, 2016 17:03
Tips for publishing to npm

Windows

On Windows, you normally checkout with crlf line endings. When publishing to npm, you don't want this as it will break on *nix. Here's how to prevent:

git clone -c core.autocrlf=false https://github.com/org/npm-module.git
cd npm-module
# test it
npm pack
npm publish
@johnrc
johnrc / rpm-setup.md
Created March 29, 2016 06:26
Commands to create an rpm

RPM Setup

To compile RPMs do the following:

yum install rpmdevtools
useradd makerpm
rpmdev-setuptree