This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% binary_image = File.open("#{Rails.root}/test/fixtures/files/photo-one.png").read %> | |
<% image_uid = Dragonfly.app.store(binary_image) %> | |
<% image_name = Dragonfly.app.fetch(image_uid).name %> | |
john_doe: | |
username: jdoe | |
email: '[email protected]' | |
first_name: John | |
last_name: Doe | |
photo_uid: image_uid | |
photo_name: image_name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User < ActiveRecord::Base # model | |
dragonfly_accessor :photo | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Process a compressed rails log file and sort the SQL | |
# statements by frequency | |
# Requires - gzip, ansifilter, sed | |
echo $ARGC | |
COMMANDNAME=`basename $0` | |
if [ $# -lt "1" ] | |
then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo sysctl net.ipv4.ip_forward=1 | |
sudo iptables -t nat -A POSTROUTING -j MASQUERADE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/dhcpd.conf | |
# | |
# Configuration for g_ether / usbpizero | |
# Only serves 1 address to the computer on the | |
# other end of the USB cable | |
# also referenced in /etc/netctl/usbpizero | |
# | |
subnet 192.168.7.0 netmask 255.255.255.0 { | |
range 192.168.7.150 192.168.7.150; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
netctl enable usbpizero | |
systemctl start dhcpd4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/modprobe.d/g_ether.conf | |
options g_ether host_addr=12:a5:cf:42:92:fd dev_addr=5e:bc:ca:27:92:b1 idVendor=1317 idProduct=42146 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/modules-load.d/raspberrypi.conf | |
bcm2708-rng | |
snd-bcm2835 | |
dwc2 | |
g_ether |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /boot/config.txt | |
# See /boot/overlays/README for all available options | |
gpu_mem=64 | |
dtoverlay=dwc2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/netctl/usbpizero | |
Description='pizero g_ether gadget' | |
Interface=usb0 | |
Connection=ethernet | |
IP=static | |
Address=('192.168.7.3/24') | |
## Gateway address is the one we'll specify later | |
## in dhcpd.conf of the computer on the other end | |
## of the USB cable | |
Gateway='192.168.7.150' |
NewerOlder