Skip to content

Instantly share code, notes, and snippets.

@phyous
phyous / interfaces
Created December 16, 2012 00:42
proper config for raspberry pi File: /etc/network/interfaces
auto lo
iface lo inet loopback
iface eth0 inet dhcp
auto wlan0
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
@phyous
phyous / notifications.sh
Created December 15, 2012 08:54
A bash function that uses the pushover api(https://pushover.net/) to send push notifications to your phone.
############################
# Push notifications script
############################
read -d '' String <<"EOF"
require "net/https"
require "socket"
url = URI.parse("https://api.pushover.net/1/messages.json")
req = Net::HTTP::Post.new(url.path)
@phyous
phyous / CountSubs.java
Created October 5, 2012 16:11
Algorithm to find # of occurrences of a substring in a given input string
/* Problem: Find # of occurrences of a substring in a given input string
Example Output:
Test string: abcdabceabcfabcabcd
Substring count for abc:5
Substring count for abcd:2
*/
public class CountSubs {
public static void main(String[] args) {
String testString = "abcdabceabcfabcabcd";