Skip to content

Instantly share code, notes, and snippets.

View cuibonobo's full-sized avatar

Jen Garcia cuibonobo

View GitHub Profile
@cuibonobo
cuibonobo / brother-dcp-7060d-on-raspberry-pi.md
Created August 9, 2015 06:19
Printer drivers for Brother DCP-7060D on a Raspberry Pi

I've tested the brlaser drivers on my Raspberry Pi and they seem to be working very well.

To install, clone the repository to your Pi and then run the following:

./autogen.sh
./configure
make
sudo make install
@cuibonobo
cuibonobo / xcode_cli_tools_install.sh
Created August 6, 2015 20:50
Install Xcode Command Line Tools directly on the Terminal
#!/bin/sh
OSX_VERS=$(sw_vers -productVersion | awk -F "." '{print $2}')
TOOLS=clitools.dmg
if [ ! -f "$TOOLS" ]; then
DMGURL=http://some-url-here.com/because/apple/expires/links/automatically.dmg
curl "$DMGURL" -o "$TOOLS"
fi
TMPMOUNT=`/usr/bin/mktemp -d /tmp/clitools.XXXX`
hdiutil attach "$TOOLS" -mountpoint "$TMPMOUNT"
@cuibonobo
cuibonobo / manage_internet_sharing.md
Created August 3, 2015 16:53
Manage internet sharing on Mac OS X
  • Get the currently connected computers: arp -i en1 -a and arp -i bridge100 -a
  • Filter connections by MAC address: http://michaelleo.com/blog/2011/02/eye-fi-upload-via-mac-os-x-internet-sharing/
  • Grab the list of DHCP leases from /private/var/db/dhcpd_leases (this won't necessarily tell you who is connected, but it's good for knowing who has connected)
  • Enable Internet Sharing with sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.InternetSharing.plist (and use unload to disable)
  • Messing with the Internet Sharing settings directly is giving me inconsistent results. For my particular case, it's easiest to just set up my Sharing settings manually and then turn the WiFi on and off based on my needs with networksetup -setairportpower en1 on or networksetup -setairportpower en1 off
@cuibonobo
cuibonobo / ssh_server_on_windows.md
Last active August 29, 2015 14:25
Getting an SSH server up on a Windows machine
  • Run the CygWin installer and make sure that openssh is installed from the 'Net' category, and cygrunsrv is installed from the 'Admin' category (the installer can be automated with command-line arguments)
  • Run CygWin as an Administrator and run ssh-host-config (this is a bash script, so you can make a similar script with the options you'd like pre-selected)
  • Note that if the machine is bound to a domain controller, local users won't be allowed to log in via SSH. More details on that here.
  • Generate an SSH key on your host with ssh-keygen -t rsa, then append the contents of the public key to ~/.ssh/authorized_keys for the guest's SSH user
  • You can now do a password-less login with ssh -i /path/to/.ssh/id_rsa ssh_user@windows_machine

When everything's done, you may want to add C:\cygwin64\bin\ to the end of your PATH (at the beginning it may override Windows default utilities with the same name). Any programs with an exe extension in that fo

@cuibonobo
cuibonobo / ping_virtualbox_vm_guest.md
Created July 23, 2015 15:55
Ping a VirtualBox Windows guest from the host.

Much help from here: http://serverfault.com/questions/225155/virtualbox-how-to-set-up-networking-so-both-host-and-guest-can-access-internet

  1. Set up your VM guest with 2 network cards: * First card set to NAT: this will connect the VM to the internet * Second card set to Host-only: this will connect the VM to the host
  2. Set the IPv4 address of the host-only network to 192.168.56.1 and its network mask to 255.255.255.0
  3. Boot up the VM and set the second network card to a static IP address: * IP address: 192.168.56.56 * Subnet mask: 255.255.255.0 * Default gateway: 192.168.56.1
@cuibonobo
cuibonobo / Namecheap-SSL.md
Created July 12, 2015 00:08
Add Namecheap.com PositiveSSL certificates to nginx on Ubuntu

Log in to your server, then create a unique key and a certificate signing request:

mkdir 2015
cd 2015/
sudo openssl genrsa -des3 -out server.key 2048
sudo openssl req -new -key server.key -out server.csr
cat server.csr

Copy the CSR into the Namecheap form and follow the instructions in order to receive a zip file with the needed certificates.

@cuibonobo
cuibonobo / UnitySwipeControl.cs
Created June 30, 2015 21:27
Unity Swipe Control
Vector3 fp;
Vector2 lp;
float dragDistance = Screen.height * 0.2f;
foreach (Touch touch in Input.touches) {
if (touch.phase == TouchPhase.Began) {
fp = touch.position;
lp = touch.position;
}
if (touch.phase == TouchPhase.Ended){
@cuibonobo
cuibonobo / rpcbind-install.md
Created May 17, 2015 17:59
Building and installing rpcbind on CentOS 7
  • Download the latest rpcbind source tarball from http://sourceforge.net/projects/rpcbind/
  • I needed to also yum install the following to get the ./configure and make steps to work: libtirpc-devel, systemd-devel, and quota-devel
  • Run ./configure, then make, and finally sudo make install