Skip to content

Instantly share code, notes, and snippets.

Variables

  1. Variable names should be in mixed case, starting with lower case: linearity, credibleThreat, qualityOfLife
  2. Large scope variables should have a meaningful name, short scope (e.g. counters) variables should have short names
  3. Variable representing the number of a certain object should be given the prefix n (or m if matrix): nFiles, nSeeds,mRows
  4. Adopt a convention on pluralization: either make all variable names singular or plural: don't create two variables that differ only by the final letter...
  5. Variables representing the index/number associated with a single entity should be prefixed by i: iTable, iEmployee
  6. Iterator variables should be prefixed by i,j,k, etc.
  7. Avoid negated boolean variable names: avoid isNotFound; rather use ~isFound
  8. Acronyms, even if normally uppercase, should be mixed or lower case isUsaSpecific rather than isUSASpecific

AT cheatsheet

Available element types

  • Aperture
ataparture(FAMNAME,[-x,+x,-y,+y],'AperturePass');

define physical aperture element (collimator)

<!DOCTYPE html>
<html>
<head>
<style>
ul {
list-style-type: none;
margin: 0;
padding: 0;
}
@gioAlea
gioAlea / mml_cheatsheet.markdown
Last active August 27, 2018 09:18
Cheatsheet for MatLab Middle Layer

MatLab Middle Layer cheatsheet

Data access modes

  • Online - r/w data from control system
  • Simulator - r/w data from AT model
  • Model - same as simulator (?)
  • Manual - read data from user input (matlab prompts user for input)
  • Special - when special functions, follows their format
@gioAlea
gioAlea / at-mml_compatibility.m
Created September 29, 2015 09:10
atcollab/ folder substituted and rinamed as at/ in the MML_Release/Release folder
>> atpath
/home/gcampogi/MML_Release/Release/at/atmat
/home/gcampogi/MML_Release/Release/at/atintegrators
>> atdiag
>> spear3;
>> plotbeta
AT was not installed correctly
>> atplot
Error using cat
Dimensions of matrices being concatenated are not consistent.
@gioAlea
gioAlea / matlab_cheatsheet.markdown
Last active August 29, 2015 14:23
matlab cheatsheet

logical values: 1 (true) ; 0(false)

logical indexing: v(v logical function) restituisce i valore che soddisfano la logical function

get help: doc funcName

close all figures: close all

Print to screen: disp 'whatever'

@gioAlea
gioAlea / sdds_cheatsheet.md
Last active February 5, 2016 16:41
SDDS_cheatsheet

SDDS

Printout

Table structure: sddsquery filename.file | more

column elements: sddsprintout filename.file -col=coltitle | more

###Export to csv sddsprintout -spreadsheet=csv -col=* filename.file filename.cdv

@gioAlea
gioAlea / jacow_template_for_lyx.markdown
Last active October 13, 2015 04:23
Tutorial on how to add the JACoW document class to LyX

Tutorial on how to add the JACoW document class to LyX

Based on a tutorial from @inspectorgadget found here.

Step 0:

Download the JACoW class from here.

Step 1:

Find the LaTeX directory: go to LyX > Tools > TeX Information > LaTeX Classes > Show path.

CERN Hacks

This Gist is a guide on how to setup your computer at CERN with Ubuntu 14.04 LTS. Last tested by myself on a brand new computer on 18/11/2014, proof tested by @Alea88.

How To Acces AFS

Step 1: install packages