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
#include <iostream> | |
#include <cstring> | |
using namespace std; | |
int main (int argc, char *argv[]) { | |
cout << "Number of args: " << argc << endl; | |
cout << "Name of program: " << argv[0] << endl; | |
if (argc > 1) { | |
cout << "2nd argument: " << argv[1] << endl; |
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
#!/usr/bin/ruby | |
require 'json' | |
require 'prawn' | |
raw = File.open("data.json") | |
json = JSON.parse(raw.read) | |
Prawn::Document.generate("result.pdf", {:page_size => 'A4', :skip_page_creation => true}) do |pdf| | |
json["teams"].each do |team| |
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
# Captures one packet and writes it to output.pcap | |
sudo tcpdump -I -P -i en0 -w output.pcap -c 1 | |
# Converts output.pcap to a more human-friendly format | |
tshark -r output.pcap -V |
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
package main | |
import ( | |
"fmt" | |
"github.com/gorilla/mux" | |
"io/ioutil" | |
"log" | |
"net/http" | |
) |
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
require 'active_support/all' | |
require 'mysql2' | |
require 'erb' | |
def get_primary_key(client, table) | |
query = "SHOW INDEX FROM #{table} WHERE Key_name = 'PRIMARY';" | |
result = client.query(query).first | |
result["Column_name"] | |
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
/** | |
* Author: Jonah George | |
* Date: December 11, 2014 | |
* Description: A simple echo server using the Winsock2 Api | |
* References: http://msdn.microsoft.com/en-us/library/windows/desktop/ms737593(v=vs.85).aspx | |
*/ | |
#undef UNICODE | |
#define WIN32_LEAN_AND_MEAN |
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
import csv | |
import math | |
from pulp import * | |
def linear_trend(x0, x1, d): | |
return x0 - (x1 * d) | |
def seasonal_pattern(x2, x3, d): | |
return x2 * math.cos( (2 * math.pi * d) / 365.25) - x3 * math.sin( (2 * math.pi * d) / 565.25 ) |
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
package main | |
func Problem1() int { | |
sum := 0 | |
for i := 0; i < 1000; i++ { | |
if i % 3 == 0 || i % 5 == 0 { | |
sum += i | |
} | |
} | |
return sum |
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
SELECT "resources".* | |
FROM "resources" | |
INNER JOIN "resources_tags" ON "resources_tags"."resource_id" = "resources"."id" | |
INNER JOIN "tags" ON "tags"."id" = "resources_tags"."tag_id" | |
WHERE ("tags"."id" IN (4,16) | |
AND (SELECT count(*) FROM "tags" WHERE "tags"."id" IN(4,16)) = 2) | |
GROUP BY "resources"."id" | |
ORDER BY "resources"."name" ASC | |
-- Ryan's new method |
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
models = Dir.glob("*.rb") | |
def spec(model) | |
template = <<-END | |
scenario "#{model}" do | |
visit rails_admin.index_path(model_name: "#{model}") | |
page.status_code.must_equal 200 | |
page.assert_current_path rails_admin.index_path(model_name: "#{model}") | |
end |
OlderNewer