Skip to content

Instantly share code, notes, and snippets.

@mrsweaters
mrsweaters / commands.sh
Last active May 8, 2019 18:51
Helpful file system commands for dealing with low diskspace.
# Ubuntu 10 largest files/directories relative to current directory
sudo du -hsx * | sort -rh | head -10
# RedHat 10 largest files/directories relative to current directory
sudo du -m --max-depth 1 | sort -rn | head -10
# autoclean removes old distro images/etc to free up space.
sudo apt-get autoclean
sudo apt-get autoremove
@mrsweaters
mrsweaters / uuid.js
Last active August 29, 2015 14:27
uuid.js
var uuid = function () {
return setTimeout(function () {
return +new Date()
}, 1);
};
var uuid = function () {
return +new Date();
};
@mrsweaters
mrsweaters / nginx.conf
Last active August 29, 2015 14:26 — forked from conorh/nginx.conf
Using Nginx as a caching proxy for Refile with Ruby on Rails
http {
...
proxy_cache_path /data/perch.squaremill.com/shared/image_cache levels=1:2 keys_zone=images:10m;
...
}
@mrsweaters
mrsweaters / docsplit-install.sh
Last active August 29, 2015 14:26 — forked from adilsoncarvalho/docsplit-install.sh
Installing Doc Split on Ubuntu/MacOS
#!/bin/bash
if [ $(uname -s) == "Darwin" ]; then
brew install graphicsmagick
brew install poppler
brew install ghostscript
brew install tesseract
wget -o ~/Downloads/pdftk_server-1.45-mac_osx-10.6-setup.pkg http://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/pdftk_server-1.45-mac_osx-10.6-setup.pkg
open ~/Downloads/pdftk_server-1.45-mac_osx-10.6-setup.pkg
else
@mrsweaters
mrsweaters / viewDidLoad.swift
Created June 19, 2015 18:27
Scale down source UIImage.
override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
if let image = tempCaptureImage {
let size = CGSizeApplyAffineTransform(image.size, CGAffineTransformMakeScale(0.5, 0.5))
UIGraphicsBeginImageContextWithOptions(size, true, 0.0)
image.drawInRect(CGRect(origin: CGPointZero, size: size))
let scaledImage = UIGraphicsGetImageFromCurrentImageContext()
import Foundation
import UIKit
import Webkit
class BasicChildBrowser:UIViewController, WKNavigationDelegate {
let web = WKWebView()
let toolbar = UIToolbar()
let progressSpinner = UIActivityIndicatorView(activityIndicatorStyle: .White)
let progressBar = UIProgressView(progressViewStyle: .Bar)
@mrsweaters
mrsweaters / tomcat.conf
Created June 9, 2015 17:45
tomcat/solr monit config
#Tomcat Monitoring
check host tomcat with address localhost
stop program = "/etc/init.d/tomcat stop"
start program = "/etc/init.d/tomcat restart"
if failed port 8080 and protocol http
then start
@mrsweaters
mrsweaters / steps.md
Last active August 29, 2015 14:22
Maintaining Hosts in Private Network

#Maintaining DNS Records Now that you have a working internal DNS, you need to maintain your DNS records so they accurately reflect your server environment.

##Adding Host to DNS

Whenever you add a host to your environment (in the same datacenter), you will want to add it to DNS. Here is a list of steps that you need to take:

###Primary Nameserver

  • Forward zone file: Add an "A" record for the new host, increment the value of "Serial"
  • Reverse zone file: Add a "PTR" record for the new host, increment the value of "Serial"
@mrsweaters
mrsweaters / netstat.sh
Created May 20, 2015 20:48
Continuously show incoming internet connections on Ubuntu
netstat -t -u -c
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')