Skip to content

Instantly share code, notes, and snippets.

@ryanuber
ryanuber / gist:9014174
Created February 15, 2014 03:31
Vagrant re-import box from files on local system

If you find that vagrant box list somehow does not contain a box you previously had, you can sometimes add the box back if you still have the sources for it in ~/.vagrant.d/boxes.

$ cd ~/.vagrant.d/boxes/precise64/0/virtualbox/
$ tar czf ~/precise64.box .
$ vagrant box add precise64 ~/precise64.box 
Downloading box from URL: file:/Users/ryanuber/precise64.box
Extracting box...te: 417M/s, Estimated time remaining: --:--:--)
Successfully added box 'precise64' with provider 'virtualbox'!
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active April 25, 2024 02:01
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

@beigna
beigna / cartero_loco.py
Last active March 3, 2017 18:14
Consulta de seguimiento del Correo. Ejemplo: https://gist.github.com/nachopro/8151015
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
from HTMLParser import HTMLParser
from datetime import datetime
from BeautifulSoup import BeautifulSoup
from prettytable import PrettyTable
import requests
@helpshift
helpshift / index.html
Created November 7, 2013 07:13
Full page helpshift support embed
<!doctype html>
<html class="no-js" lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="viewport" content="minimum-scale=1, maximum-scale=1, width=device-width">
<title> ***Your support page title here*** </title>
<meta name="description" content=" ***Your support page description here*** ">
@mmasashi
mmasashi / update_column_type.sql
Created October 22, 2013 20:18
How to change the column type for Redshift.
BEGIN;
LOCK table_name;
ALTER TABLE table_name ADD COLUMN column_new column_type;
UPDATE table_name SET column_new = column_name;
ALTER TABLE table_name DROP column_name;
ALTER TABLE table_name RENAME column_new TO column_name;
END;
-- varchar -> integer
-- UPDATE cpvbeacon_dev SET column_new = CAST (nullif(column_name, '') AS INTEGER);
@wsargent
wsargent / docker_cheat.md
Last active August 31, 2023 12:10
Docker cheat sheet
@nateware
nateware / chef_vagrant.sh
Last active July 14, 2017 02:44
Getting started with Vagrant and VirtualBox to test Chef with AWS OpsWorks
# Create vagrant image
vagrant init ubuntu12_64 http://files.vagrantup.com/precise64.box
vagrant up
vagrant ssh
# Fork aws/opsworks-cookbooks on github
# https://github.com/aws/opsworks-cookbooks
# Clone locally
git clone git@github.com:yourusername/opsworks-cookbooks.git
cd opsworks-cookbooks
@FokkeZB
FokkeZB / IMPORT.md
Last active May 24, 2023 21:24
Add support for @import to Alloy styles

@import TSS for Alloy

NOTE: This is out-dated, I suggest using https://github.com/dbankier/ltss instead.

This alloy.jmk adds support for using CSS-like @import "file.tss"; statements in Alloy TSS styles.

The idea for this came when discussing adding the option of including a CSS-like reset stylesheet in Alloy to make up for platform differences in (background)color, but also some good practices.

I think one of the key issues in this discussion is that there is no such thing as the base style for an app. iOS fans would like to reset to iOS-like styles, Android fans like to reset to theirs, flat UI fanatics would like everything minimalized and Bootstrap adepts will ask for a huge library of styles.

@mauropm
mauropm / app.js
Created July 4, 2013 00:22
An example of generic app with different actions according to the button. It's showing how to manage the destruction of the window after you use it, and other nice things. To use: Create a new classic mobile project in Titanium Studio, and copy all this files to Resources directory. This is intended to work with Titanium Mobile SDK 3.1.1.GA, wit…
// INcluding memory management utils.
Ti.include('utils.js');
// root window.
var win = Ti.UI.createWindow({
backgroundColor:'white',
exitOnclose:true,
});
@yuta-imai
yuta-imai / UserData script for setup CloudWatch
Last active March 13, 2022 01:28
With this user data script, you can set up cron job to put some custom metrics for CloudWatch at instance initiation.
#!/bin/sh
cd /home/ec2-user
wget http://ec2-downloads.s3.amazonaws.com/cloudwatch-samples/CloudWatchMonitoringScripts-v1.1.0.zip
unzip CloudWatchMonitoringScripts-v1.1.0.zip
rm CloudWatchMonitoringScripts-v1.1.0.zip
chown ec2-user:ec2-user aws-scripts-mon
echo "*/5 * * * * ec2-user /home/ec2-user/aws-scripts-mon/mon-put-instance-data.pl --mem-util --disk-space-util --disk-path=/ --from-cron" >> /etc/crontab