Skip to content

Instantly share code, notes, and snippets.

@CyberAstronaut101
Last active February 14, 2019 01:16
Show Gist options
  • Save CyberAstronaut101/dc97d9f054c2ef39212d20ac83a4ae9a to your computer and use it in GitHub Desktop.
Save CyberAstronaut101/dc97d9f054c2ef39212d20ac83a4ae9a to your computer and use it in GitHub Desktop.
Scripts on Turing

To see where the shell will look for binaries to execute: echo $PATH. You should see that the first entry is /home/yourADusername/bin

This means that anything you place in your ~/bin folder that is also executable will be executed.

Here are a few scripts that make working on turing quicker:

/home/ejmason/bin/myproc

this script will run ps -aefl --forest .... every second

#!/bin/bash

while true
do
    clear
    ps -aefl --forest | grep -v myproc | grep --color -E $USER
    sleep 1
done

To create the script:

  1. vim ~/bin/myproc
  2. paste above code, make sure to change grep -v myproc to reflect what your script is named
  3. chmod u+x ~/bin/myproc
  4. run from command line by typing myproc

/home/ejmason/bin/mm

#!/bin/bash
make clean
make

same create instructions as first, just have to run mm and with the changes in the Makefile that is all you should have to type for each build/execution

Makefile

GCC       = gcc
EXE       = zombie
OBJ       = zombie.o
SOURCE    = zombie.c

default: $(EXE)

$(OBJ): $(SOURCE)
        $(GCC) -c -o $@ $(SOURCE) -std=gnu99 -lrt

$(EXE): $(OBJ)
        $(GCC) $(OBJ) -o $(EXE) -std=gnu99 -lrt
        ./$(EXE) &
clean:
        rm -rf *.o $(EXE)

this makefile will start the compiled program in the background.. ./$(EXE) &

for the correntz one, just add a number for testing

I use vim, mainly because it has a c linter, see https://github.com/amix/vimrc for vim configuration files.

Or if you want to use your own editor on your computer, see if it has an SFTP client plugin that you can connect to turing with, so you can write code on your computer, it will reflect changes on turing, and you will just have to run make from a PuTTY session.

@CyberAstronaut101
Copy link
Author

CyberAstronaut101 commented Feb 14, 2019

Sublime Text: https://wbond.net/sublime_packages/sftp

This has been the best sftp plugin across multiple editors

You dont have to pay, but every like 6 saves it will prompt you to buy the full version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment