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
# 1. Install homebrew | |
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
# 2. Tape science | |
brew tap homebrew/science | |
# 3. Upgrade homebrew | |
brew update && brew upgrade | |
brew install gcc |
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
# 1. Create file | |
touch .octave | |
# 2. In your .octaverc file, place the following code | |
setenv ("GNUTERM", "X11") |
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
# If you use bash, key in the following commands in your terminal | |
cd ~ | |
open .bash_profile | |
# Paste this line in your file | |
export FONTCONFIG_PATH=/opt/X11/lib/X11/fontconfig | |
# If you use zsh, key in the following commands in your terminal | |
cd ~ | |
open .zshrc |
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 i = 1:10, | |
v(i) = 2^i; | |
end; |
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
i = 1; | |
while i <= 5, | |
v(i) = 100; | |
i = i + 1; | |
end; | |
i = 1; | |
while i <= 5, | |
v(i) = 999; | |
i = i + 1; |
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
v(1) = 2; | |
if v(1) == 1, | |
disp('The value is one'); | |
elseif v(1) == 2, | |
disp('The value is two'); | |
else | |
disp('The value is not one or two'); | |
end; |
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
# Total, Average and Count Computation from numbers in a text file with a mix of words and numbers | |
fname = input('Enter file name: ') | |
# Ensure your file is in the same folder as this script | |
# Test file used here is mbox.txt | |
fhandle = open(fname) | |
# Seeking number after this word x | |
x = 'X-DSPAM-Confidence:' | |
y = len(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
# Find the smallest and largest numbers | |
# This allows the user to enter a list of numbers until the user types done or press enter then the prompt would stop | |
# Author: Ritchie Ng | |
largest = None | |
smallest = None | |
while True: | |
num = input('Enter a number: ') |
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
# Total, Average and Count Computation from numbers in a text file with a mix of words and numbers | |
fname = input('Enter file name: ') | |
# Ensure your file is in the same folder as this script | |
# Test file used here is mbox.txt | |
fhandle = open(fname) | |
# Seeking number after this word x | |
x = 'X-DSPAM-Confidence:' | |
y = len(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
# Collate list of timings and counts, sort, and find most/least common timings in an email log | |
# This script uses mbox.txt to give you an example of how it might work | |
# 1. Prompt for file to load | |
fname = input('Enter file name: ') | |
# 2. File handle to access file | |
fhandle = open(fname) | |
# 3a. Create counts dictionary |
OlderNewer