Skip to content

Instantly share code, notes, and snippets.

View SamTebbs33's full-sized avatar

Sam Tebbs SamTebbs33

  • United Kingdom
  • 16:46 (UTC)
View GitHub Profile
@SamTebbs33
SamTebbs33 / colours.sh
Created May 10, 2015 11:20
Bash prompt colours
# Reset
Color_Off='\e[0m' # Text Reset
# Regular Colors
Black='\e[0;30m' # Black
Red='\e[0;31m' # Red
Green='\e[0;32m' # Green
Yellow='\e[0;33m' # Yellow
Blue='\e[0;34m' # Blue
Purple='\e[0;35m' # Purple
@SamTebbs33
SamTebbs33 / new_gist_file_0
Last active August 29, 2015 14:21
The standard types in Ash, ordered by precedence.
String
bool
float64
float32
uint64
uint
uint16
uint8
int64
int
/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
import java.lang.reflect.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
@SamTebbs33
SamTebbs33 / var_dec_rules.md
Last active August 29, 2015 14:22
Ash variable declaration rules
Type Assignment Optional allowed
Optional N Y
Non-optional Y N
Const Y(Y/N if optional) Y
@SamTebbs33
SamTebbs33 / keybase.md
Created June 14, 2015 18:41
Keybase verification

Keybase proof

I hereby claim:

  • I am samtebbs33 on github.
  • I am samtebbs33 (https://keybase.io/samtebbs33) on keybase.
  • I have a public key whose fingerprint is C68F EF07 69B1 A4FE 82CA 0AE9 982B 7052 6E24 ED08

To claim this, I am signing this object:

## Source code
class Test {
public static func main(args : String[]) {
const array = [int, 2] // New int array of length 2
var i = 0
while i < array.length {
var a = array[i] // Tetsing if I get an exception here
i = i + 1
}
}
@SamTebbs33
SamTebbs33 / gist:e3526ead92952b5342a7
Created July 20, 2015 11:18
Creating a git repo
# Create a new repository on the command line
echo "# maple" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/ash-lang/maple.git
git push -u origin master
# Push an existing repository from the command line
git remote add origin https://github.com/ash-lang/maple.git
@SamTebbs33
SamTebbs33 / commands.sh
Last active October 16, 2015 15:52
SSH Commands
# Execute these two commands and replace "$file" with the file that is loaded each time you open the terminal (google to find the one for your OS)
# Replace "$user" with your username and "$path" with the location of the directory that you want to sync. This directory's contents will be copied to the "work" directory in the lab computers
echo 'alias unissh="ssh $user@tinky-winky.cs.bham.ac.uk"' >> $file
echo 'alias unisync="rsync -aP $path/ $user@tinky-winky.cs.bham.ac.uk:work"' >> $file
# Then execute the following command (you don't have to do this each time you open the terminal)
. $file
# Now, when you execute the "unissh" command, you will ssh into the lab computers. When you execute the "unisync" command, the files in the folder you specified will be copied over to the lab computers
@SamTebbs33
SamTebbs33 / wk7ex3.ml
Created November 13, 2015 17:28
FOCS Wk7Ex3a
let rec dif l1 l2 acc prev =
(* "get_ne" returns a copy of "lst" but without the elements that are equal to "p". "a" is the accumulator *)
let rec get_ne lst p a = match lst with
| [] -> a
| hd :: tl when p = hd -> get_ne tl p a
| hd :: tl -> get_ne tl p (hd :: a)
in match (l1, l2) with
| [], [] -> acc
| _, [] -> get_ne l1 prev acc
| [], _ -> get_ne l2 prev acc
@SamTebbs33
SamTebbs33 / ssh_transfer.sh
Created November 13, 2015 22:58
SSH file transfer
# From remote to local
scp user@tinky-winky.cs.bham.ac.uk:path/to/file path/to/local/destination
# From local to remote
scp path/to/local/file user@tinky-winky.cs.bham.ac.uk:path/to/destination