Skip to content

Instantly share code, notes, and snippets.

View ritchieng's full-sized avatar
🤓

Ritchie Ng ritchieng

🤓
View GitHub Profile
@ritchieng
ritchieng / terminal_octave_mac.txt
Last active April 8, 2019 06:18
Terminal Steps | Octave Mac OSX Setup
# 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
@ritchieng
ritchieng / octaverc_config.txt
Created June 25, 2016 13:40
.octaverc configuration
# 1. Create file
touch .octave
# 2. In your .octaverc file, place the following code
setenv ("GNUTERM", "X11")
# 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
for i = 1:10,
v(i) = 2^i;
end;
i = 1;
while i <= 5,
v(i) = 100;
i = i + 1;
end;
i = 1;
while i <= 5,
v(i) = 999;
i = i + 1;
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;
@ritchieng
ritchieng / average_parse_p3.py
Created June 30, 2016 15:48
Normal Hours and Overtime Salary Computation
# 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)
@ritchieng
ritchieng / find_smallest_largest_num_p3.py
Created June 30, 2016 15:48
Seeking Smallest and Largest Number
# 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: ')
@ritchieng
ritchieng / average_parse_p3.py
Created June 30, 2016 15:51
Completed Total, Average and Count Computation from numbers in a text
# 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)
@ritchieng
ritchieng / key_value_count_sort_p3.py
Created June 30, 2016 15:51
Collate list of timings and counts, sort, and find most/least timings in an email log
# 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