Skip to content

Instantly share code, notes, and snippets.

@quark-zju
Created November 23, 2012 19:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save quark-zju/4136961 to your computer and use it in GitHub Desktop.
Save quark-zju/4136961 to your computer and use it in GitHub Desktop.
Linux tutorial slide for MSTC.ZJU
doctype html
- @title = 'Linux Tutorial (Part 2)'
- @author = 'quark@mstczju'
html
head
title = @title
// https://code.google.com/p/google-code-prettify/
scss:
@media screen {
.pln { color: #000; }
.str, .atv { color: #080; }
.tag, .kwd { color: #008; }
.com { color: #800; }
.typ, .atn, .dec, .var { color: #606; }
.lit { color: #066; }
.pun, .opn, .clo { color: #660; }
.fun { color: red; } }
@media projection {
.str, .atv { color: #EC7600; }
.kwd { color: #93C763; }
.com { color: #66747B; }
.typ { color: #678CB1; }
.lit { color: #FACD22; }
.pun, .pln { color: #F1F2F3; }
.tag { color: #8AC763; }
.atn { color: #E0E2E4; }
.dec { color: purple; } }
javascript:
window.PR_SHOULD_USE_CONTINUATION=!0,function(){function L(e){function a(e){var t=e.charCodeAt(0);if(t!==92)return t;var n=e.charAt(1);return t=u[n],t?t:"0"<=n&&n<="7"?parseInt(e.substring(1),8):n==="u"||n==="x"?parseInt(e.substring(2),16):e.charCodeAt(1)}function f(e){if(e<32)return(e<16?"\\x0":"\\x")+e.toString(16);var t=String.fromCharCode(e);if(t==="\\"||t==="-"||t==="["||t==="]")t="\\"+t;return t}function l(e){var t=e.substring(1,e.length-1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g")),n=[],r=[],i=t[0]==="^";for(var s=i?1:0,o=t.length;s<o;++s){var u=t[s];if(/\\[bdsw]/i.test(u))n.push(u);else{var l=a(u),c;s+2<o&&"-"===t[s+1]?(c=a(t[s+2]),s+=2):c=l,r.push([l,c]),c<65||l>122||(c<65||l>90||r.push([Math.max(65,l)|32,Math.min(c,90)|32]),c<97||l>122||r.push([Math.max(97,l)&-33,Math.min(c,122)&-33]))}}r.sort(function(e,t){return e[0]-t[0]||t[1]-e[1]});var h=[],p=[NaN,NaN];for(var s=0;s<r.length;++s){var d=r[s];d[0]<=p[1]+1?p[1]=Math.max(p[1],d[1]):h.push(p=d)}var v=["["];i&&v.push("^"),v.push.apply(v,n);for(var s=0;s<h.length;++s){var d=h[s];v.push(f(d[0])),d[1]>d[0]&&(d[1]+1>d[0]&&v.push("-"),v.push(f(d[1])))}return v.push("]"),v.join("")}function c(e){var r=e.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g")),i=r.length,s=[];for(var o=0,u=0;o<i;++o){var a=r[o];if(a==="(")++u;else if("\\"===a.charAt(0)){var f=+a.substring(1);f&&f<=u&&(s[f]=-1)}}for(var o=1;o<s.length;++o)-1===s[o]&&(s[o]=++t);for(var o=0,u=0;o<i;++o){var a=r[o];if(a==="(")++u,s[u]===undefined&&(r[o]="(?:");else if("\\"===a.charAt(0)){var f=+a.substring(1);f&&f<=u&&(r[o]="\\"+s[u])}}for(var o=0,u=0;o<i;++o)"^"===r[o]&&"^"!==r[o+1]&&(r[o]="");if(e.ignoreCase&&n)for(var o=0;o<i;++o){var a=r[o],c=a.charAt(0);a.length>=2&&c==="["?r[o]=l(a):c!=="\\"&&(r[o]=a.replace(/[a-zA-Z]/g,function(e){var t=e.charCodeAt(0);return"["+String.fromCharCode(t&-33,t|32)+"]"}))}return r.join("")}var t=0,n=!1,r=!1;for(var i=0,s=e.length;i<s;++i){var o=e[i];if(o.ignoreCase)r=!0;else if(/[a-z]/i.test(o.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){n=!0,r=!1;break}}var u={b:8,t:9,n:10,v:11,f:12,r:13},h=[];for(var i=0,s=e.length;i<s;++i){var o=e[i];if(o.global||o.multiline)throw new Error(""+o);h.push("(?:"+c(o)+")")}return new RegExp(h.join("|"),r?"gi":"g")}function A(e){function a(e){switch(e.nodeType){case 1:if(t.test(e.className))return;for(var o=e.firstChild;o;o=o.nextSibling)a(o);var f=e.nodeName;if("BR"===f||"LI"===f)n[s]="\n",i[s<<1]=r++,i[s++<<1|1]=e;break;case 3:case 4:var l=e.nodeValue;l.length&&(u?l=l.replace(/\r\n?/g,"\n"):l=l.replace(/[ \t\r\n]+/g," "),n[s]=l,i[s<<1]=r,r+=l.length,i[s++<<1|1]=e)}}var t=/(?:^|\s)nocode(?:\s|$)/,n=[],r=0,i=[],s=0,o;e.currentStyle?o=e.currentStyle.whiteSpace:window.getComputedStyle&&(o=document.defaultView.getComputedStyle(e,null).getPropertyValue("white-space"));var u=o&&"pre"===o.substring(0,3);return a(e),{sourceCode:n.join("").replace(/\n$/,""),spans:i}}function O(e,t,n,r){if(!t)return;var i={sourceCode:t,basePos:e};n(i),r.push.apply(r,i.decorations)}function _(e){var t=undefined;for(var n=e.firstChild;n;n=n.nextSibling){var r=n.nodeType;t=r===1?t?e:n:r===3?M.test(n.nodeValue)?e:t:t}return t===e?undefined:t}function D(e,t){var n={},r;(function(){var i=e.concat(t),s=[],o={};for(var u=0,a=i.length;u<a;++u){var f=i[u],l=f[3];if(l)for(var c=l.length;--c>=0;)n[l.charAt(c)]=f;var h=f[1],p=""+h;o.hasOwnProperty(p)||(s.push(h),o[p]=null)}s.push(/[\0-\uffff]/),r=L(s)})();var i=t.length,s=function(e){var o=e.sourceCode,u=e.basePos,a=[u,w],f=0,l=o.match(r)||[],c={};for(var h=0,p=l.length;h<p;++h){var d=l[h],v=c[d],m=void 0,g;if(typeof v=="string")g=!1;else{var y=n[d.charAt(0)];if(y)m=d.match(y[1]),v=y[0];else{for(var b=0;b<i;++b){y=t[b],m=d.match(y[1]);if(m){v=y[0];break}}m||(v=w)}g=v.length>=5&&"lang-"===v.substring(0,5),g&&(!m||typeof m[1]!="string")&&(g=!1,v=x),g||(c[d]=v)}var E=f;f+=d.length;if(!g)a.push(u+E,v);else{var S=m[1],T=d.indexOf(S),N=T+S.length;m[2]&&(N=d.length-m[2].length,T=N-S.length);var C=v.substring(5);O(u+E,d.substring(0,T),s,a),O(u+E+T,S,q(C,S),a),O(u+E+N,d.substring(N),s,a)}}e.decorations=a};return s}function P(e){var t=[],n=[];e.tripleQuotedStrings?t.push([d,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""]):e.multiLineStrings?t.push([d,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):t.push([d,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"]),e.verbatimStrings&&n.push([d,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var r=e.hashComments;r&&(e.cStyleComments?(r>1?t.push([m,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):t.push([m,/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),n.push([d,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,null])):t.push([m,/^#[^\r\n]*/,null,"#"])),e.cStyleComments&&(n.push([m,/^\/\/[^\r\n]*/,null]),n.push([m,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));if(e.regexLiterals){var i="/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/";n.push(["lang-regex",new RegExp("^"+k+"("+i+")")])}var s=e.types;s&&n.push([g,s]);var o=(""+e.keywords).replace(/^ | $/g,"");return o.length&&n.push([v,new RegExp("^(?:"+o.replace(/[\s,]+/g,"|")+")\\b"),null]),t.push([w,/^\s+/,null," \r\n  "]),n.push([y,/^@[a-z_$][a-z_$@0-9]*/i,null],[g,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[w,/^[a-z_$][a-z_$@0-9]*/i,null],[y,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[w,/^\\[\s\S]?/,null],[b,/^.[^\s\w\.$@\'\"\`\/\#\\]*/,null]),D(t,n)}function B(e,t){function f(e){switch(e.nodeType){case 1:if(n.test(e.className))break;if("BR"===e.nodeName)l(e),e.parentNode&&e.parentNode.removeChild(e);else for(var t=e.firstChild;t;t=t.nextSibling)f(t);break;case 3:case 4:if(o){var s=e.nodeValue,u=s.match(r);if(u){var a=s.substring(0,u.index);e.nodeValue=a;var c=s.substring(u.index+u[0].length);if(c){var h=e.parentNode;h.insertBefore(i.createTextNode(c),e.nextSibling)}l(e),a||e.parentNode.removeChild(e)}}}}function l(e){function t(e,n){var r=n?e.cloneNode(!1):e,i=e.parentNode;if(i){var s=t(i,1),o=e.nextSibling;s.appendChild(r);for(var u=o;u;u=o)o=u.nextSibling,s.appendChild(u)}return r}while(!e.nextSibling){e=e.parentNode;if(!e)return}var n=t(e.nextSibling,0);for(var r;(r=n.parentNode)&&r.nodeType===1;)n=r;a.push(n)}var n=/(?:^|\s)nocode(?:\s|$)/,r=/\r\n?|\n/,i=e.ownerDocument,s;e.currentStyle?s=e.currentStyle.whiteSpace:window.getComputedStyle&&(s=i.defaultView.getComputedStyle(e,null).getPropertyValue("white-space"));var o=s&&"pre"===s.substring(0,3),u=i.createElement("LI");while(e.firstChild)u.appendChild(e.firstChild);var a=[u];for(var c=0;c<a.length;++c)f(a[c]);t===(t|0)&&a[0].setAttribute("value",t);var h=i.createElement("OL");h.className="linenums";var p=Math.max(0,t-1|0)||0;for(var c=0,d=a.length;c<d;++c)u=a[c],u.className="L"+(c+p)%10,u.firstChild||u.appendChild(i.createTextNode(" ")),h.appendChild(u);e.appendChild(h)}function j(e){var t=/\bMSIE\b/.test(navigator.userAgent),n=/\n/g,r=e.sourceCode,i=r.length,s=0,o=e.spans,u=o.length,a=0,f=e.decorations,l=f.length,c=0;f[l]=i;var h,p;for(p=h=0;p<l;)f[p]!==f[p+2]?(f[h++]=f[p++],f[h++]=f[p++]):p+=2;l=h;for(p=h=0;p<l;){var d=f[p],v=f[p+1],m=p+2;while(m+2<=l&&f[m+1]===v)m+=2;f[h++]=d,f[h++]=v,p=m}l=f.length=h;var g=null;while(a<u){var y=o[a],b=o[a+2]||i,w=f[c],E=f[c+2]||i,m=Math.min(b,E),S=o[a+1],x;if(S.nodeType!==1&&(x=r.substring(s,m))){t&&(x=x.replace(n,"\r")),S.nodeValue=x;var T=S.ownerDocument,N=T.createElement("SPAN");N.className=f[c+1];var C=S.parentNode;C.replaceChild(N,S),N.appendChild(S),s<b&&(o[a+1]=S=T.createTextNode(r.substring(m,b)),C.insertBefore(S,N.nextSibling))}s=m,s>=b&&(a+=2),s>=E&&(c+=2)}}function I(e,t){for(var n=t.length;--n>=0;){var r=t[n];F.hasOwnProperty(r)?window.console&&console.warn("cannot override language handler %s",r):F[r]=e}}function q(e,t){if(!e||!F.hasOwnProperty(e))e=/^\s*</.test(t)?"default-markup":"default-code";return F[e]}function R(e){var t=e.langExtension;try{var n=A(e.sourceNode),r=n.sourceCode;e.sourceCode=r,e.spans=n.spans,e.basePos=0,q(t,r)(e),j(e)}catch(i){"console"in window&&console.log(i&&i.stack?i.stack:i)}}function U(e,t,n){var r=document.createElement("PRE");r.innerHTML=e,n&&B(r,n);var i={langExtension:t,numberLines:n,sourceNode:r};return R(i),r.innerHTML}function z(e){function t(e){return document.getElementsByTagName(e)}function h(){var t=window.PR_SHOULD_USE_CONTINUATION?u.now()+250:Infinity;for(;a<r.length&&u.now()<t;a++){var n=r[a],i=n.className;if(i.indexOf("prettyprint")>=0){var s=i.match(l),o;!s&&(o=_(n))&&"CODE"===o.tagName&&(s=o.className.match(l)),s&&(s=s[1]);var c=!1;for(var p=n.parentNode;p;p=p.parentNode)if((p.tagName==="pre"||p.tagName==="code"||p.tagName==="xmp")&&p.className&&p.className.indexOf("prettyprint")>=0){c=!0;break}if(!c){var d=n.className.match(/\blinenums\b(?::(\d+))?/);d=d?d[1]&&d[1].length?+d[1]:!0:!1,d&&B(n,d),f={langExtension:s,sourceNode:n,numberLines:d},R(f)}}}a<r.length?setTimeout(h,250):e&&e()}var n=[t("pre"),t("code"),t("xmp")],r=[];for(var i=0;i<n.length;++i)for(var s=0,o=n[i].length;s<o;++s)r.push(n[i][s]);n=null;var u=Date;u.now||(u={now:function(){return+(new Date)}});var a=0,f,l=/\blang(?:uage)?-([\w.]+)(?!\S)/,c=/\bprettyprint\b/;h()}var e=["break,continue,do,else,for,if,return,while"],t=[e,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],n=[t,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],r=[n,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],i=[n,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"],s=[i,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"],o="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes",u=[n,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],a="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",f=[e,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],l=[e,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],c=[e,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],h=[r,s,u,a+f,l,c],p=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,d="str",v="kwd",m="com",g="typ",y="lit",b="pun",w="pln",E="tag",S="dec",x="src",T="atn",N="atv",C="nocode",k="(?:^^\\.?|[+-]|\\!|\\!=|\\!==|\\#|\\%|\\%=|&|&&|&&=|&=|\\(|\\*|\\*=|\\+=|\\,|\\-=|\\->|\\/|\\/=|:|::|\\;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\@|\\[|\\^|\\^=|\\^\\^|\\^\\^=|\\{|\\||\\|=|\\|\\||\\|\\|=|\\~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*",M=/\S/,H=P({keywords:h,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),F={};I(H,["default-code"]),I(D([],[[w,/^[^<?]+/],[S,/^<!\w[^>]*(?:>|$)/],[m,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[b,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),I(D([[w,/^[\s]+/,null," \r\n"],[N,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[[E,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[T,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[b,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),I(D([],[[N,/^[\s\S]+/]]),["uq.val"]),I(P({keywords:r,hashComments:!0,cStyleComments:!0,types:p}),["c","cc","cpp","cxx","cyc","m"]),I(P({keywords:"null,true,false"}),["json"]),I(P({keywords:s,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:p}),["cs"]),I(P({keywords:i,cStyleComments:!0}),["java"]),I(P({keywords:c,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]),I(P({keywords:f,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py"]),I(P({keywords:a,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]),I(P({keywords:l,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]),I(P({keywords:u,cStyleComments:!0,regexLiterals:!0}),["js"]),I(P({keywords:o,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),I(D([],[[d,/^[\s\S]+/]]),["regex"]),window.prettyPrintOne=U,window.prettyPrint=z,window.PR={createSimpleLexer:D,registerLangHandler:I,sourceDecorator:P,PR_ATTRIB_NAME:T,PR_ATTRIB_VALUE:N,PR_COMMENT:m,PR_DECLARATION:S,PR_KEYWORD:v,PR_LITERAL:y,PR_NOCODE:C,PR_PLAIN:w,PR_PUNCTUATION:b,PR_SOURCE:x,PR_STRING:d,PR_TAG:E,PR_TYPE:g}}();
sass:
@media screen
body
background-color: #fff
margin: 30px
font-family: Dejavu Sans, Verdana, Serif
font-size: 14px
color: #4F5155
a
color: #003399
background-color: transparent
font-weight: normal
text-decoration: none
h1, h2
color: #444
background-color: transparent
font-size: 16px
font-weight: bold
margin: 24px 0 2px 0
padding: 5px 0 6px 0
h1
border-bottom: 1px solid #D0D0D0
h1.standalone
border-botton: 0px none
pre
line-height: 100%
font-family: Consolas
font-size: 12px
background-color: #f9f9f9
border: 1px solid #D0D0D0
color: #002166
display: block
margin: 14px 0 14px 0
padding: 12px 10px 12px 10px
height: auto !important
.slide
ul
font-size: 100% !important
table
padding-left: 30px
td, th
font-size: 90%
text-align: center
border: 1px solid #D0D0D0
border-collapse: collapse
a:hover
background: navy
color: white
.footer
background-color: #444
position: fixed
bottom: 0px
width: 100%
left: 0px
td
color: white
margin: 1px
font-weight: normal
text-decoration: none
font-size: 0.7em
.hide
display: none
@media projection
.slide
padding: 3% 12% 0px 12%
display: block
page-break-after: always
&.title
padding: 28% 12% 0px 12%
display: block
h1
font-size: 75px
color: #07c
border-bottom: 8px solid #555
body
padding: 0px
background-color: #46483E
font-size: 35px
font-family: Verdana, sans-serif
color: #D2D8BA
line-height: 1.4em
.slide
li b
color: white
table
margin: auto
font-size: 35px
background: #222
td, th
font-family: Consolas, sans-serif
text-align: center
border: 1px solid #333
border-collapse: collapse
th
width: 39%
font-family: Verdana
h1, h2
font-weight: normal
font-size: 55px
font-family: Verdana, sans-serif
padding-top: 0
padding-bottom: 0
margin-top: 40px
margin-bottom: 24px
color: #8CC84B
h1.standalone
margin-top: 400px
font-size: 75px
b
color: #8CC84B
h1.white
color: white
b
color: white
h2
color: #4BC892
img
text-align: center
blockquote
border-left: 3px solid #8CC84B
margin: 0px 0px
padding: 20px
background-color: #33342D
font-size: 0.9em
pre
font-family: Consolas
line-height: 1em
font-size: 24px
background-color: #33342D
overflow-y: auto
overflow-x: auto
color: #eee
display: block
margin: 14px 0 14px 0
padding: 12px 10px 12px 10px
text-shadow: none
a
color: #669900
text-decoration: none
&:hover
text-decoration: underline
ul code
font-family: Dejavu Sans Mono
background-color: #33342D
padding: 0px 7px
.small
font-size: 70%
.footer
display: none
.author
text-align: right
font-size: 60%
font-style: italic
margin-top: -0.3em
body onload="prettyPrint()"
.footer
table
tr
td align='left' style='width:100%' = @title
td align='right' = @author
.slide
h1.standalone <b>GNU / Linux</b>
.slide
h1 Linux 支持的体系
ul
li x86 / x64 / ia64
li ARM
li MIPS
li ...
/服务器,平板,路由器
.slide
h1 Linux 做什么
/mplayer Revolution.OS.avi -ss 2:24 -endpos 45
ul
li 管理文件
li 调度进程
li 使用设备
li ...
.slide
h1.standalone 文件系统
.slide
h2 基础知识
ul
li 目录分隔符: '/'
li 根目录: '/'
li
| 文件名
pre.prettyprint.lang-sh
| touch '?:-+(){}[]*'
li
| 链接
pre.prettyprint.lang-sh
| ln /usr/bin/vim ~/tmp/v -s
.slide
h2 虚拟文件系统
ul
li tmpfs
pre.prettyprint.lang-sh
| mkdir /tmp/ram
mount none -t tmpfs /tmp/ram
dd if=/dev/full of=/tmp/ram/test bs=1M count=1000
li sshfs
a href='http://en.wikipedia.org/wiki/Virtual_file_system'
.slide
h2 全是文件
ul
li
| /dev/sda1
pre.prettyprint.lang-sh
| cp /dev/sda1 /media/foo/1.img
cat /media/foo/1.img > /dev/sda1
li
| /proc, /sys
pre.prettyprint.lang-sh
| mpg123 audio.mp3
rm video.avi
cd /proc/`pidof mpg123`/fd
ls -l
cp -L 8 /tmp/audio.mp3
pre.prettyprint.lang-sh
| echo 1 > /sys/devices/virtual/leds/*/brightness
a href='http://en.wikipedia.org/wiki/Everything_is_a_file'
.slide
h1 进程管理
ul
li 不区分进程与线程
/ man clone
li 优先级和窗口焦点无关
/ 内核不直接管理 GUI
li 创建进程用时短
pre.prettyprint.lang-sh
| cat > hello.c
main() { puts("hello"); }
gcc hello.c -o hello
pre.prettyprint.lang-sh
| time ( for ((i=0;i<200;++i)); do ./hello; done )
pre.prettyprint
| PROMPT $P$T$G
ECHO %TIME% && FOR /L %i IN (1,1,200) DO @hello
/pre.prettyprint
| '/usr/bin/[' -e /bin/sh ']'
/许多工作直接运行进程来解决
a href='http://stackoverflow.com/questions/47845/why-is-creating-a-new-process-more-expensive-on-windows-than-linux'
.slide
h1.standalone 常用工具
.slide
h2 man
pre.prettyprint.lang-sh
| man man
man clone
man 1 read
man 2 read
man 3 read
/ 很多时候不需要问其他人
.slide
h2 zsh
pre.prettyprint.lang-sh
| > hello.c
pre.prettyprint.lang-sh
| /v/c/p/p&lt;TAB&gt;
p 同类工具
ul
li bash
li fish
.slide
h2 gcc
ul
li <b>G</b>NU <b>C</b>ompiler <b>C</b>ollection
li <b>g</b>nu <b>c</b> <b>compiler</b>
pre.prettyprint.lang-sh
| gcc hello.c -o hello
p 同类工具
ul
li clang
li tcc
.slide
h2 pkg-config
pre.prettyprint.lang-sh
| pkg-config --cflags --libs opencv
pre.prettyprint
| #include &lt;cv.h&gt;
int main() {
cvNamedWindow("A Window", 0);
cvWaitKey(0);
return 0;
}
pre.prettyprint.lang-sh
| gcc `pkg-config --cflags --libs opencv` w.c
.slide
h2 make
pre.prettyprint
| hello: hello.c
gcc hello.c -o hello
.slide
h1 线上交流
p 讨论
ul
li
| IRC:
a href='http://freenode.net' freenode.net
/ 使用 Opera 可以快速访问 freenode.net
li 邮件列表
p 贡献
ul
li: a href='http://sf.net' sf.net
li: a href='http://code.google.com' code.google.com
li: a href='http://github.com' github.com
.slide
h1 学校课程
ul
li 课程综合实践II
li 操作系统分析及实验
.slide
h1.standalone Q & A
DEST=linux-tutorial-slide.html
$(DEST): %.html: %.slim
slimrb $< > $@
clean:
-rf -f *.html
show: $(DEST)
opera $<
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment