This file contains hidden or 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
| /////////////////////////////////////////////////////////////////////////// | |
| // Example code from the Udacity tutorial on CUDA // | |
| // Link to the video here: https://www.youtube.com/watch?v=GiGE3QjwknQ // | |
| // TO COMPILE: $ nvcc -o square square.cu // | |
| /////////////////////////////////////////////////////////////////////////// | |
| // | |
| // NOTES: | |
| // * Device: is the term of the GPU | |
| // * Host: is the term of the CPU |
This file contains hidden or 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 urlparse | |
| import oauth2 as oauth | |
| consumer_key = '' | |
| consumer_secret = '' | |
| request_token_url = 'http://www.tumblr.com/oauth/request_token' | |
| access_token_url = 'http://www.tumblr.com/oauth/access_token' | |
| authorize_url = 'http://www.tumblr.com/oauth/authorize' |
This file contains hidden or 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> | |
| using namespace std; | |
| struct node { | |
| int data; | |
| struct node* next; | |
| }; | |
| void push(struct node** head_ref, int new_data){ |
This file contains hidden or 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/env bash | |
| say "Do it | |
| Just do it | |
| Don't let your dreams be dreams | |
| Yesterday you said tomorrow | |
This file contains hidden or 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
| # An example of how to write to the terminal without a constant clear | |
| #!/bin/bash | |
| LINES=$(tput lines) | |
| COLUMNS=$(tput cols) | |
| declare -A snowflakes | |
| declare -A lastflakes | |
| clear |
This file contains hidden or 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/env python | |
| import socket, sys, random | |
| DNS_IP = sys.argv[1][1:] | |
| DNS_NAME = sys.argv[2] | |
| MSG = '\xDB\x42\x01\x00\x00\x01\x00\x00\x00\x00\x00\x00' | |
| names = DNS_NAME.split('.') | |
| for s in names: | |
| MSG += chr(len(s)) + s | |
| MSG = '\x00\x00\x01\x00\x01' | |
| sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) |
This file contains hidden or 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/env ruby | |
| # Caleb Adams | |
| # echoServer! | |
| require 'socket' | |
| # test for inputs | |
| if (ARGV.length != 1) | |
| abort("please enter the port number after the program") | |
| end | |
| # get the port number | |
| port = ARGV[0] |
This file contains hidden or 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
| # just testing | |
| clear | |
| echo %n | |
| LINES=$(tput cols) | |
| COLUMNS=$(tput lines) | |
| tput cup 0 0 | |
| echo "X" |
This file contains hidden or 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
| for ip in $(seq 1 254); do ping -c 1 192.168.1.$ip>/dev/null; [ $? -eq 0 ] && echo "192.168.1.$ip UP" || : ; done |
This file contains hidden or 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/env python | |
| import socket, sys, struct | |
| UDP_sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
| UDP_sock.bind(("127.0.0.1", int(sys.argv[1]))) | |
| UDP_data, UDP_addr = UDP_sock.recvfrom(1024) | |
| TCP_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
| TCP_sock.connect((sys.argv[2][1:], 53)) | |
| TCP_sock.send(struct.pack("!H", len(UDP_data)) + UDP_data) | |
| TCP_data = TCP_sock.recv(1024) | |
| UDP_sock.sendto(TCP_data[2:], UDP_addr) |
NewerOlder