### Shell Script Example: Git Repository Setup and Server Start Source: https://github.com/assimon/dujiaoka/blob/master/public/vendor/dcat-admin/dcat/plugins/editor-md/lib/codemirror/mode/shell/index.html A bash script demonstrating cloning a Git repository, generating HTTPS credentials, and starting a Node.js server in HTTPS mode. Includes a method to stop the server. ```bash #!/bin/bash # clone the repository git clone http://github.com/garden/tree # generate HTTPS credentials cd tree openssl genrsa -aes256 -out https.key 1024 openssl req -new -nodes -key https.key -out https.csr openssl x509 -req -days 365 -in https.csr -signkey https.key -out https.crt cp https.key{,.orig} openssl rsa -in https.key.orig -out https.key # start the server in HTTPS mode cd web sudo node ../server.js 443 'yes' >> ../node.log & # here is how to stop the server for pid in \ `ps aux | grep 'node ../server.js' | awk '{print $2}'` ; do sudo kill -9 $pid 2> /dev/null done exit 0 ``` -------------------------------- ### Dockerfile Syntax Highlighting Example Source: https://github.com/assimon/dujiaoka/blob/master/public/vendor/dcat-admin/dcat/plugins/editor-md/lib/codemirror/mode/dockerfile/index.html This is a complete Dockerfile example demonstrating various instructions and commands for setting up an environment. It installs Ghost blogging platform and runs its development environment. ```dockerfile # Install Ghost blogging platform and run development environment # # VERSION 1.0.0 FROM ubuntu:12.10 MAINTAINER Amer Grgic "amer@livebyt.es" WORKDIR /data/ghost # Install dependencies for nginx installation RUN apt-get update RUN apt-get install -y python g++ make software-properties-common --force-yes RUN add-apt-repository ppa:chris-lea/node.js RUN apt-get update # Install unzip RUN apt-get install -y unzip # Install curl RUN apt-get install -y curl # Install nodejs & npm RUN apt-get install -y rlwrap RUN apt-get install -y nodejs # Download Ghost v0.4.1 RUN curl -L https://ghost.org/zip/ghost-latest.zip -o /tmp/ghost.zip # Unzip Ghost zip to /data/ghost RUN unzip -uo /tmp/ghost.zip -d /data/ghost # Add custom config js to /data/ghost ADD ./config.example.js /data/ghost/config.js # Install Ghost with NPM RUN cd /data/ghost/ && npm install --production # Expose port 2368 EXPOSE 2368 # Run Ghost CMD ["npm","start"] ``` -------------------------------- ### Puppet Module Example Source: https://github.com/assimon/dujiaoka/blob/master/public/vendor/dcat-admin/dcat/plugins/editor-md/lib/codemirror/mode/puppet/index.html This is a comprehensive example of a Puppet module for installing and configuring AutoMySQLBackup. It demonstrates class definitions, parameter handling, file resource management, and conditional package installation. ```puppet # == Class: automysqlbackup # # Puppet module to install AutoMySQLBackup for periodic MySQL backups. # # class { # 'automysqlbackup': # backup_dir => '/mnt/backups', # } # class automysqlbackup ( $bin_dir = $automysqlbackup::params::bin_dir, $etc_dir = $automysqlbackup::params::etc_dir, $backup_dir = $automysqlbackup::params::backup_dir, $install_multicore = undef, $config = {}, $config_defaults = {}, ) inherits automysqlbackup::params { # Ensure valid paths are assigned validate_absolute_path($bin_dir) validate_absolute_path($etc_dir) validate_absolute_path($backup_dir) # Create a subdirectory in /etc for config files file { $etc_dir: ensure => directory, owner => 'root', group => 'root', mode => '0750', } # Create an example backup file, useful for reference file { "${etc_dir}/automysqlbackup.conf.example": ensure => file, owner => 'root', group => 'root', mode => '0660', source => 'puppet:///modules/automysqlbackup/automysqlbackup.conf', } # Add files from the developer file { "${etc_dir}/AMB_README": ensure => file, source => 'puppet:///modules/automysqlbackup/AMB_README', } file { "${etc_dir}/AMB_LICENSE": ensure => file, source => 'puppet:///modules/automysqlbackup/AMB_LICENSE', } # Install the actual binary file file { "${bin_dir}/automysqlbackup": ensure => file, owner => 'root', group => 'root', mode => '0755', source => 'puppet:///modules/automysqlbackup/automysqlbackup', } # Create the base backup directory file { $backup_dir: ensure => directory, owner => 'root', group => 'root', mode => '0755', } # If you'd like to keep your config in hiera and pass it to this class if !empty($config) { create_resources('automysqlbackup::backup', $config, $config_defaults) } # If using RedHat family, must have the RPMforge repo's enabled if $install_multicore { package { ['pigz', 'pbzip2']: ensure => installed } } } ``` -------------------------------- ### Install Composer and Project Dependencies Source: https://github.com/assimon/dujiaoka/blob/master/debian_manual.md Downloads and installs Composer, then uses it to install project dependencies. It also creates a new user and switches to it for the installation. ```bash cd /var/www/dujiaoka php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" php composer-setup.php php -r "unlink('composer-setup.php');" mv composer.phar /usr/local/bin/composer adduser user su user composer install composer update su ``` -------------------------------- ### Install Composer Dependencies Source: https://github.com/assimon/dujiaoka/wiki/2.x_linux_install Downloads the Composer installer, sets up Composer globally, and then installs and updates project dependencies using Composer. ```bash cd /home/wwwroot/dujiaoka php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" php composer-setup.php php -r "unlink('composer-setup.php');" mv composer.phar /usr/local/bin/composer composer install composer update ``` -------------------------------- ### Install Opcache Addon Source: https://github.com/assimon/dujiaoka/wiki/2.x_linux_install Installs the Opcache PHP extension to improve PHP performance. ```bash ./addons.sh install opcache ``` -------------------------------- ### Install Redis Addon Source: https://github.com/assimon/dujiaoka/wiki/2.x_linux_install Installs the Redis server as an addon to the existing LNMP environment. ```bash cd /root/lnmp1.8 ./addons.sh install redis ``` -------------------------------- ### Install Nginx Web Server Source: https://github.com/assimon/dujiaoka/blob/master/debian_manual.md Installs the Nginx web server, a high-performance web server. ```bash apt install nginx ``` -------------------------------- ### Install MariaDB Database Server Source: https://github.com/assimon/dujiaoka/blob/master/debian_manual.md Installs the MariaDB database server, a drop-in replacement for MySQL. ```bash apt install mariadb-server ``` -------------------------------- ### Install System Configuration Source: https://context7.com/assimon/dujiaoka/llms.txt Handles the installation process by writing environment configuration, running SQL scripts, and creating a lock file. It validates database and Redis connection details before proceeding. ```php // POST /do-install // Form fields: db_host, db_port, db_database, db_username, db_password, // redis_host, redis_port, redis_password, app_url, ... // HomeController@doInstall (simplified): $mysqlDB = [ 'host' => $request->input('db_host'), // e.g. "127.0.0.1" 'port' => $request->input('db_port'), // e.g. "3306" 'database' => $request->input('db_database'), // e.g. "dujiaoka" 'username' => $request->input('db_username'), 'password' => $request->input('db_password'), ]; $redisDB = [ 'host' => $request->input('redis_host'), // e.g. "127.0.0.1" 'password' => $request->input('redis_password', 'null'), 'port' => $request->input('redis_port'), // e.g. "6379" ]; // Merges config, tests DB + Redis, imports SQL, writes .env and install.lock // Returns: "success" on OK, or an error string on failure. ``` -------------------------------- ### Download and Extract LNMP Installation Script Source: https://github.com/assimon/dujiaoka/wiki/2.x_linux_install Starts a screen session for persistent installation, downloads the LNMP installation package, extracts it, and navigates into the installation directory. ```bash screen -S lnmp wget http://soft.vpser.net/lnmp/lnmp1.8.tar.gz -cO lnmp1.8.tar.gz tar zxf lnmp1.8.tar.gz rm -rf lnmp1.8.tar.gz cd lnmp1.8 ./install.sh lnmp ``` -------------------------------- ### Install Editor.md with Bower Source: https://github.com/assimon/dujiaoka/blob/master/public/vendor/dcat-admin/dcat/plugins/editor-md/README.md Use Bower to install the Editor.md library. This command fetches and installs the package into your project. ```shell bower install editor.md ``` -------------------------------- ### YAML List Example Source: https://github.com/assimon/dujiaoka/blob/master/public/vendor/dcat-admin/dcat/plugins/editor-md/lib/codemirror/mode/yaml/index.html Demonstrates a simple YAML list structure for items like movies. ```yaml --- # Favorite movies - Casablanca - North by Northwest - The Man Who Wasn't There --- ``` -------------------------------- ### Rust Code Example Source: https://github.com/assimon/dujiaoka/blob/master/public/vendor/dcat-admin/dcat/plugins/editor-md/lib/codemirror/mode/rust/index.html This is an example of Rust code demonstrating various syntax elements. ```rust // Demo code. type foo = int; enum bar { some(int, foo), none } fn check_crate(x: int) { let v = 10; alt foo { 1 to 3 { print_foo(); if x { blah() + 10; } } (x, y) { "bye" } _ { "hi" } } } ``` -------------------------------- ### Install Redis In-Memory Data Store Source: https://github.com/assimon/dujiaoka/blob/master/debian_manual.md Installs Redis, an open-source, in-memory data structure store. ```bash apt install redis ``` -------------------------------- ### Tornado Template Example Source: https://github.com/assimon/dujiaoka/blob/master/public/vendor/dcat-admin/dcat/plugins/editor-md/lib/codemirror/mode/tornado/index.html An example of an HTML file with embedded Tornado template syntax, demonstrating variable output and loops. ```html My Tornado web application

{{ title }}

``` -------------------------------- ### Soy Template Example Source: https://github.com/assimon/dujiaoka/blob/master/public/vendor/dcat-admin/dcat/plugins/editor-md/lib/codemirror/mode/soy/index.html Demonstrates a basic Soy template with parameters and conditional logic. ```soy {namespace example} /** * Says hello to the world. */ {template .helloWorld} {@param name: string} {@param? score: number} Hello {$name}!
{if $score} {$score} points {else} no score {/if}
{/template} {template .alertHelloWorld kind="js"} alert('Hello World'); {/template} ``` -------------------------------- ### XQuery Basic Syntax Example Source: https://github.com/assimon/dujiaoka/blob/master/public/vendor/dcat-admin/dcat/plugins/editor-md/lib/codemirror/mode/xquery/index.html Demonstrates basic XQuery syntax including comments, let bindings, and element construction. ```xquery xquery version "1.0-ml"; (: this is : a "comment" :) let $let := "test"function() $var {function()} {$var} let $joe:=1 return element element { attribute attribute { 1 }, element test { 'a' }, attribute foo { "bar" }, fn:doc()[ foo/@bar eq $let ], //x } (: a more 'evil' test :) (: Modified Blakeley example (: with nested comment :) ... :) declare private function local:declare() {()}; declare private function local:private() {()}; declare private function local:function() {()}; declare private function local:local() {()}; ``` -------------------------------- ### Install Necessary PHP Extensions Source: https://github.com/assimon/dujiaoka/wiki/2.x_bt_install Install these PHP extensions via Baota's Software Store for enhanced functionality and performance. ```bash fileinfo redis opcache(optional) ``` -------------------------------- ### YAML Shopping List Example Source: https://github.com/assimon/dujiaoka/blob/master/public/vendor/dcat-admin/dcat/plugins/editor-md/lib/codemirror/mode/yaml/index.html Shows a YAML list format for a shopping list. ```yaml --- # Shopping list [milk, pumpkin pie, eggs, juice] --- ``` -------------------------------- ### HTTP Request Example Source: https://github.com/assimon/dujiaoka/blob/master/public/vendor/dcat-admin/dcat/plugins/editor-md/lib/codemirror/mode/http/index.html This is an example of an HTTP POST request with headers and a body, suitable for syntax highlighting in the HTTP mode. ```http POST /somewhere HTTP/1.1 Host: example.com If-Modified-Since: Sat, 29 Oct 1994 19:43:31 GMT Content-Type: application/x-www-form-urlencoded; charset=utf-8 User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/536.11 (KHTML, like Gecko) Ubuntu/12.04 Chromium/20.0.1132.47 Chrome/20.0.1132.47 Safari/536.11 This is the request body! ``` -------------------------------- ### Asterisk Dialplan Configuration Example Source: https://github.com/assimon/dujiaoka/blob/master/public/vendor/dcat-admin/dcat/plugins/editor-md/lib/codemirror/mode/asterisk/index.html This is an example of an Asterisk extensions.conf file, demonstrating various dialplan contexts, extensions, and commands. It includes general settings, context definitions, and specific extension configurations for calls, voicemail, and demos. ```asterisk ; extensions.conf - the Asterisk dial plan ; [general] ; ; If static is set to no, or omitted, then the pbx_config will rewrite ; this file when extensions are modified. Remember that all comments ; made in the file will be lost when that happens. static=yes #include "/etc/asterisk/additional_general.conf" [iaxprovider] switch => IAX2/user:[key]@myserver/mycontext [dynamic] #exec /usr/bin/dynamic-peers.pl [trunkint] ; International long distance through trunk exten => _9011.,1,Macro(dundi-e164,${EXTEN:4}) exten => _9011.,n,Dial(${GLOBAL(TRUNK)}/${FILTER(0-9,${EXTEN:${GLOBAL(TRUNKMSD)}})}) [local] ; Master context for local, toll-free, and iaxtel calls only ignorepat => 9 include => default [demo] include => stdexten ; We start with what to do when a call first comes in. exten => s,1,Wait(1) ; Wait a second, just for fun same => n,Answer ; Answer the line same => n,Set(TIMEOUT(digit)=5) ; Set Digit Timeout to 5 seconds same => n,Set(TIMEOUT(response)=10) ; Set Response Timeout to 10 seconds same => n(restart),BackGround(demo-congrats) ; Play a congratulatory message same => n(instruct),BackGround(demo-instruct) ; Play some instructions same => n,WaitExten ; Wait for an extension to be dialed. exten => 2,1,BackGround(demo-moreinfo) ; Give some more information. exten => 2,n,Goto(s,instruct) exten => 3,1,Set(LANGUAGE()=fr) ; Set language to french exten => 3,n,Goto(s,restart) ; Start with the congratulations exten => 1000,1,Goto(default,s,1) ; ; We also create an example user, 1234, who is on the console and has ; voicemail, etc. ; exten => 1234,1,Playback(transfer,skip) ; "Please hold while..." ; (but skip if channel is not up) exten => 1234,n,Gosub(${EXTEN},stdexten(${GLOBAL(CONSOLE)})) exten => 1234,n,Goto(default,s,1) ; exited Voicemail exten => 1235,1,Voicemail(1234,u) ; Right to voicemail exten => 1236,1,Dial(Console/dsp) ; Ring forever exten => 1236,n,Voicemail(1234,b) ; Unless busy ; # for when they're done with the demo exten => #,1,Playback(demo-thanks) ; "Thanks for trying the demo" exten => #,n,Hangup ; Hang them up. ; A timeout and "invalid extension rule" exten => t,1,Goto(#,1) ; If they take too long, give up exten => i,1,Playback(invalid) ; "That's not valid, try again" ; Create an extension, 500, for dialing the ; Asterisk demo. exten => 500,1,Playback(demo-abouttotry); Let them know what's going on exten => 500,n,Dial(IAX2/guest@pbx.digium.com/s@default) ; Call the Asterisk demo exten => 500,n,Playback(demo-nogo) ; Couldn't connect to the demo site exten => 500,n,Goto(s,6) ; Return to the start over message. ; Create an extension, 600, for evaluating echo latency. exten => 600,1,Playback(demo-echotest) ; Let them know what's going on exten => 600,n,Echo ; Do the echo test exten => 600,n,Playback(demo-echodone) ; Let them know it's over exten => 600,n,Goto(s,6) ; Start over ; You can use the Macro Page to intercom a individual user exten => 76245,1,Macro(page,SIP/Grandstream1) ; or if your peernames are the same as extensions exten => _7XXX,1,Macro(page,SIP/${EXTEN}) ; System Wide Page at extension 7999 exten => 7999,1,Set(TIMEOUT(absolute)=60) exten => 7999,2,Page(Local/Grandstream1@page&Local/Xlite1@page&Local/1234@page/n) ; Give voicemail at extension 8500 exten => 8500,1,VoicemailMain exten => 8500,n,Goto(s,6) ``` -------------------------------- ### CoffeeScript Baseline Setup Source: https://github.com/assimon/dujiaoka/blob/master/public/vendor/dcat-admin/dcat/plugins/editor-md/lib/codemirror/mode/coffeescript/index.html Establishes the root object (window or global) and saves the previous value of the '_' variable. ```coffeescript # Establish the root object, `window` in the browser, or `global` on the server. root = this # Save the previous value of the `_` variable. previousUnderscore = root._ ``` -------------------------------- ### Install PHP 7.4 and Extensions Source: https://github.com/assimon/dujiaoka/blob/master/debian_manual.md Installs PHP 7.4 along with common extensions required for web applications. ```bash apt install php php-fpm php-mysql php-gd php-zip php-opcache php-curl php-mbstring php-intl php-dom php-bcmath php-redis php-fileinfo ``` -------------------------------- ### Jade Templating Syntax Example Source: https://github.com/assimon/dujiaoka/blob/master/public/vendor/dcat-admin/dcat/plugins/editor-md/lib/codemirror/mode/jade/index.html This is an example of Jade templating syntax. It demonstrates basic HTML structure, conditional logic, and loops. ```jade doctype html html head title= "Jade Templating CodeMirror Mode Example" link(rel='stylesheet', href='/css/bootstrap.min.css') link(rel='stylesheet', href='/css/index.css') script(type='text/javascript', src='/js/jquery-1.9.1.min.js') script(type='text/javascript', src='/js/bootstrap.min.js') body div.header h1 Welcome to this Example div.spots if locals.spots each spot in spots div.spot.well div if spot.logo img.img-rounded.logo(src=spot.logo) else img.img-rounded.logo(src="img/placeholder.png") h3 a(href=spot.hash) ##{spot.hash} if spot.title span.title #{spot.title} if spot.desc div #{spot.desc} else h3 There are no spots currently available. ``` -------------------------------- ### Install Supervisor Process Control System Source: https://github.com/assimon/dujiaoka/blob/master/debian_manual.md Installs Supervisor, a process control system that helps manage background processes. ```bash apt install supervisor ``` -------------------------------- ### Pascal Code Examples Source: https://github.com/assimon/dujiaoka/blob/master/public/vendor/dcat-admin/dcat/plugins/editor-md/lib/codemirror/mode/pascal/index.html Illustrates various Pascal control flow and declaration structures. This code is for demonstration purposes within the documentation. ```pascal while a <> b do writeln('Waiting'); ``` ```pascal if a > b then writeln('Condition met') else writeln('Condition not met'); ``` ```pascal for i := 1 to 10 do writeln('Iteration: ', i:1); ``` ```pascal repeat a := a + 1 until a = 10; ``` ```pascal case i of 0: write('zero'); 1: write('one'); 2: write('two') end; ``` -------------------------------- ### PHP Code Example Source: https://github.com/assimon/dujiaoka/blob/master/public/vendor/dcat-admin/dcat/plugins/editor-md/lib/codemirror/mode/php/index.html Illustrates PHP syntax within an HTML context, including variable assignments, echo statements, and function calls. This example is intended for use with the PHP mode in CodeMirror. ```php 1, 'b' => 2, 3 => 'c'); echo "$a[a] ${a[3] /* } comment */} {$a[b]} \$a[a]"; function hello($who) { return "Hello $who!"; } ?> ``` ```html

The program says .

``` -------------------------------- ### HTML Example with XML Mode Source: https://github.com/assimon/dujiaoka/blob/master/public/vendor/dcat-admin/dcat/plugins/editor-md/lib/codemirror/mode/xml/index.html This example demonstrates an HTML structure parsed by CodeMirror's XML mode. The indentation attempts to be intuitive but may not match all user styles. ```html HTML Example The indentation tries to be somewhat "do what I mean"... but might not match your style. ``` -------------------------------- ### CSS Syntax Highlighting Example Source: https://github.com/assimon/dujiaoka/blob/master/public/vendor/dcat-admin/dcat/plugins/editor-md/lib/codemirror/mode/css/index.html This is an example of CSS syntax as rendered by the CodeMirror CSS mode. It includes basic CSS rules and an import statement. ```css /* Some example CSS */ @import url("something.css"); body { margin: 0; padding: 3em 6em; font-family: tahoma, arial, sans-serif; color: #000; } #navigation a { font-weight: bold; text-decoration: none !important; } h1 { font-size: 2.5em; } h2 { font-size: 1.7em; } h1:before, h2:before { content: "::"; } code { font-family: courier, monospace; font-size: 80%; color: #418A8A; } ``` -------------------------------- ### Textile Mode Syntax Examples Source: https://github.com/assimon/dujiaoka/blob/master/public/vendor/dcat-admin/dcat/plugins/editor-md/lib/codemirror/mode/textile/index.html Demonstrates various Textile syntax elements including headers, phrase modifiers, lists, and links. ```textile h1. Textile Mode A paragraph without formatting. p. A simple Paragraph. h2. Phrase Modifiers Here are some simple phrase modifiers: *strong*, _emphasis_, **bold**, and __italic__. A ??citation??, -deleted text-, +inserted text+, some ^superscript^, and some ~subscript~. A %span element% and @code element@ A "link":http://example.com, a "link with (alt text)":urlAlias [urlAlias]http://example.com/ An image: !http://example.com/image.png! and an image with a link: !http://example.com/image.png!:http://example.com A sentence with a footnote.[123] fn123. The footnote is defined here. Registered(r), Trademark(tm), and Copyright(c) ``` ```textile h2. Headers h1. Top level h2. Second level h3. Third level h4. Fourth level h5. Fifth level h6. Lowest level ``` ```textile h2. Lists * An unordered list ** foo bar *** foo bar **** foo bar ** foo bar # An ordered list ## foo bar ### foo bar #### foo bar ## foo bar - definition list := description - another item := foo bar - spanning ines := foo bar foo bar =: ``` ```textile h2. Attributes Layouts and phrase modifiers can be modified with various kinds of attributes: alignment, CSS ID, CSS class name, language, padding, and CSS styles. h3. Alignment div<. left align div>. right align h3. CSS ID and class name You are a %(my-id#my-classname) rad% person. h3. Language p[en_CA]. Strange weather, eh? h3. Horizontal Padding p(())). 2em left padding, 3em right padding h3. CSS styling p{background: red}. Fire! ``` ```textile h2. Table |"_. Header 1"|"_. Header 2"| |{background:#ddd}. Cell with background| Normal | |\2. Cell spanning 2 columns | |/2. Cell spanning 2 rows |(cell-class). one | | two | |>. Right aligned cell |<. Left aligned cell | ``` ```textile h3. A table with attributes: table(#prices). |Adults|$5| |Children|$2| ``` ```textile h2. Code blocks bc. function factorial(n) { if (n === 0) { return 1; } return n * factorial(n - 1); } ``` ```textile pre.. ,,,,,, o#'9MMHb':'-,o, .oH":HH$" "' ' -*R&o, dMMM*"'\`' .oM"HM?. ,MMM' "HLbd< ?&H\ .:MH ."\ \` MM MM&b . "*H - &MMMMMMMMMH: . dboo MMMMMMMMMMMM. . dMMMMMMb *MMMMMMMMMP. . MMMMMMMP *MMMMMP . \`#MMMMM MM6P , ' \`MMMP" HM*\`, ' :MM .- , '. \`#?.. . ..' -. . .- ''-.oo,oo.-'' \. _(9> \==\_) -'= ``` ```textile h2. Temporarily disabling textile markup notextile. Don't __touch this!__ Surround text with double-equals to disable textile inline. Example: Use ==*asterisks*== for *strong* text. ``` ```html

Title

Hello!

``` -------------------------------- ### COBOL Program Example Source: https://github.com/assimon/dujiaoka/blob/master/public/vendor/dcat-admin/dcat/plugins/editor-md/lib/codemirror/mode/cobol/index.html A sample COBOL program demonstrating basic structure and syntax, used for syntax highlighting. ```cobol 000010 IDENTIFICATION DIVISION. MODTGHERE 000020 PROGRAM-ID. SAMPLE. 000030 AUTHOR. TEST SAM. 000040 DATE-WRITTEN. 5 February 2013 000041 000042* A sample program just to show the form. 000043* The program copies its input to the output, 000044* and counts the number of records. 000045* At the end this number is printed. 000046 000050 ENVIRONMENT DIVISION. 000060 INPUT-OUTPUT SECTION. 000070 FILE-CONTROL. 000080 SELECT STUDENT-FILE ASSIGN TO SYSIN 000090 ORGANIZATION IS LINE SEQUENTIAL. 000100 SELECT PRINT-FILE ASSIGN TO SYSOUT 000110 ORGANIZATION IS LINE SEQUENTIAL. 000120 000130 DATA DIVISION. 000140 FILE SECTION. 000150 FD STUDENT-FILE 000160 RECORD CONTAINS 43 CHARACTERS 000170 DATA RECORD IS STUDENT-IN. 000180 01 STUDENT-IN PIC X(43). 000190 000200 FD PRINT-FILE 000210 RECORD CONTAINS 80 CHARACTERS 000220 DATA RECORD IS PRINT-LINE. 000230 01 PRINT-LINE PIC X(80). 000240 000250 WORKING-STORAGE SECTION. 000260 01 DATA-REMAINS-SWITCH PIC X(2) VALUE SPACES. 000261 01 RECORDS-WRITTEN PIC 99. 000270 000280 01 DETAIL-LINE. 000290 05 FILLER PIC X(7) VALUE SPACES. 000300 05 RECORD-IMAGE PIC X(43). 000310 05 FILLER PIC X(30) VALUE SPACES. 000311 000312 01 SUMMARY-LINE. 000313 05 FILLER PIC X(7) VALUE SPACES. 000314 05 TOTAL-READ PIC 99. 000315 05 FILLER PIC X VALUE SPACE. 000316 05 FILLER PIC X(17) 000317 VALUE 'Records were read'. 000318 05 FILLER PIC X(53) VALUE SPACES. 000319 000320 PROCEDURE DIVISION. 000321 000330 PREPARE-SENIOR-REPORT. 000340 OPEN INPUT STUDENT-FILE 000350 OUTPUT PRINT-FILE. 000351 MOVE ZERO TO RECORDS-WRITTEN. 000360 READ STUDENT-FILE 000370 AT END MOVE 'NO' TO DATA-REMAINS-SWITCH 000380 END-READ. 000390 PERFORM PROCESS-RECORDS 000410 UNTIL DATA-REMAINS-SWITCH = 'NO'. 000411 PERFORM PRINT-SUMMARY. 000420 CLOSE STUDENT-FILE 000430 PRINT-FILE. 000440 STOP RUN. 000450 000460 PROCESS-RECORDS. 000470 MOVE STUDENT-IN TO RECORD-IMAGE. 000480 MOVE DETAIL-LINE TO PRINT-LINE. 000490 WRITE PRINT-LINE. 000500 ADD 1 TO RECORDS-WRITTEN. 000510 READ STUDENT-FILE 000520 AT END MOVE 'NO' TO DATA-REMAINS-SWITCH 000530 END-READ. 000540 000550 PRINT-SUMMARY. 000560 MOVE RECORDS-WRITTEN TO TOTAL-READ. 000570 MOVE SUMMARY-LINE TO PRINT-LINE. 000571 WRITE PRINT-LINE. 000572 000580 ``` -------------------------------- ### Gas Assembler Syntax Example Source: https://github.com/assimon/dujiaoka/blob/master/public/vendor/dcat-admin/dcat/plugins/editor-md/lib/codemirror/mode/gas/index.html This snippet demonstrates the AT&T assembler syntax handled by the Gas mode, including multi-line and single-line comments. ```gas .syntax unified .global main /\* \n * A \n * multi-line \n * comment. \n*/ @ A single line comment. main: push {sp, lr} ldr r0, =message bl puts mov r0, #0 pop {sp, pc} message: .asciz "Hello world!
" ``` -------------------------------- ### CodeMirror Editor Setup Source: https://github.com/assimon/dujiaoka/blob/master/public/vendor/dcat-admin/dcat/plugins/editor-md/lib/codemirror/mode/livescript/index.html Initializes a CodeMirror editor instance with specific configurations for LiveScript. This includes setting the theme and enabling line numbers. ```javascript var editor = CodeMirror.fromTextArea(document.getElementById("code"), { theme: "solarized light", lineNumbers: true }); ``` -------------------------------- ### Secure MariaDB Installation Source: https://github.com/assimon/dujiaoka/blob/master/debian_manual.md Runs the security script for MariaDB to set root password, remove anonymous users, etc. Follow the prompts. ```bash mysql_secure_installation ``` -------------------------------- ### Check PHP Modules Source: https://github.com/assimon/dujiaoka/wiki/2.x_linux_install Verifies if the 'fileinfo' and 'zip' PHP modules are installed and enabled by checking their presence in the output of 'php -m'. ```bash php -m | grep fileinfo php -m | grep zip ``` -------------------------------- ### reST Explicit Markup Block Example Source: https://github.com/assimon/dujiaoka/blob/master/public/vendor/dcat-admin/dcat/plugins/editor-md/lib/codemirror/mode/rst/index.html Illustrates the syntax for an explicit markup block in reStructuredText, which starts with '.. ' and is terminated by indentation. ```rst .. _directives: Directives ---------- A directive (:duref:`ref `) is a generic block of explicit markup. ``` -------------------------------- ### HAML Syntax Examples Source: https://github.com/assimon/dujiaoka/blob/master/public/vendor/dcat-admin/dcat/plugins/editor-md/lib/codemirror/mode/haml/index.html Illustrates various HAML syntax elements including HTML-like tags, Ruby interpolation, comments, and conditional rendering. ```haml !!! #content .left.column(title="title") {:href => "/hello", :test => "#{hello}\_#{world}"} %h2 Welcome to our site! %p= puts "HAML MODE" .right.column = render :partial => "sidebar" .container .row .span8 %h1.title= @page_title %p.title= @page_title %p / The same as HTML comment Hello multiline comment -# haml comment This wont be displayed nor will this Date/Time: - now = DateTime.now %strong= now - if now > DateTime.parse("December 31, 2006") = "Happy new " + "year!" %title = @title \= @title

Title

Title

``` -------------------------------- ### APL Game of Life Example Source: https://github.com/assimon/dujiaoka/blob/master/public/vendor/dcat-admin/dcat/plugins/editor-md/lib/codemirror/mode/apl/index.html This APL code demonstrates Conway's game of life, including creature definition, board setup, and generation logic. It's inspired by an online demo. ```apl ⍝ Conway's game of life ⍝ This example was inspired by the impressive demo at ⍝ http://www.youtube.com/watch?v=a9xAKttWgP4 ⍝ Create a matrix: ⍝ 0 1 1 ⍝ 1 1 0 ⍝ 0 1 0 creature ← (3 3 ⍴ ⍳ 9) ∈ 1 2 3 4 7 ⍝ Original creature from demo creature ← (3 3 ⍴ ⍳ 9) ∈ 1 3 6 7 8 ⍝ Glider ⍝ Place the creature on a larger board, near the centre board ← ¯1 ⊖ ¯2 ⌽ 5 7 ↑ creature ⍝ A function to move from one generation to the next life ← {∨/ 1 ⍵ ∧ 3 4 = ⊂+/ +⌿ 1 0 ¯1 ∘.⊖ 1 0 ¯1 ⌽¨ ⊂⍵} ⍝ Compute n-th generation and format it as a ⍝ character matrix gen ← {' #'\(life ⍣ ⍵) board] ⍝ Show first three generations (gen 1) (gen 2) (gen 3) ``` -------------------------------- ### Configure .env for Database Connection Source: https://github.com/assimon/dujiaoka/wiki/1.x_bt_install Rename .env.example to .env and configure database connection details. Ensure other project settings are modified carefully. ```bash # 数据库配置 DB_CONNECTION=mysql DB_HOST=数据库地址 DB_PORT=数据库端口 DB_DATABASE=数据库 DB_USERNAME=数据库登录用户 DB_PASSWORD=数据库密码 ``` -------------------------------- ### JSON-LD Example Data Source: https://github.com/assimon/dujiaoka/blob/master/public/vendor/dcat-admin/dcat/plugins/editor-md/lib/codemirror/mode/javascript/json-ld.html This is an example of JSON-LD data structure. ```json { "@context": { "name": "http://schema.org/name", "description": "http://schema.org/description", "image": { "@id": "http://schema.org/image", "@type": "@id" }, "geo": "http://schema.org/geo", "latitude": { "@id": "http://schema.org/latitude", "@type": "xsd:float" }, "longitude": { "@id": "http://schema.org/longitude", "@type": "xsd:float" }, "xsd": "http://www.w3.org/2001/XMLSchema#" }, "name": "The Empire State Building", "description": "The Empire State Building is a 102-story landmark in New York City.", "image": "http://www.civil.usherbrooke.ca/cours/gci215a/empire-state-building.jpg", "geo": { "latitude": "40.75", "longitude": "73.98" } } ``` -------------------------------- ### IDL Code Example Source: https://github.com/assimon/dujiaoka/blob/master/public/vendor/dcat-admin/dcat/plugins/editor-md/lib/codemirror/mode/idl/index.html This is an example of IDL code that calculates the average and standard deviation of an array. ```idl ;; Example IDL code FUNCTION mean_and_stddev,array ;; This program reads in an array of numbers ;; and returns a structure containing the ;; average and standard deviation ave = 0.0 count = 0.0 for i=0,N_ELEMENTS(array)-1 do begin ave = ave + array[i] count = count + 1 endfor ave = ave/count std = stddev(array) return, {average:ave,std:std} END ``` -------------------------------- ### Import SQL Database with Artisan Source: https://github.com/assimon/dujiaoka/wiki/1.x_bt_install Execute the Artisan command to import the SQL file and set up the database. Adjust the PHP path based on your server's PHP version. ```bash /www/server/php/72/bin/php artisan dujiao install ``` -------------------------------- ### Modelica Code Example Source: https://github.com/assimon/dujiaoka/blob/master/public/vendor/dcat-admin/dcat/plugins/editor-md/lib/codemirror/mode/modelica/index.html This is an example of Modelica code demonstrating a 'BouncingBall' model with parameters for elasticity and gravity. ```modelica model BouncingBall parameter Real e = 0.7; parameter Real g = 9.81; Real h(start=1); Real v; Boolean flying(start=true); Boolean impact; Real v_new; equation impact = h <= 0.0; der(v) = if flying then -g else 0; der(h) = v; when {h <= 0.0 and v <= 0.0, impact} then v_new = if edge(impact) then -e*pre(v) else 0; flying = v_new > 0; reinit(v, v_new); end when; annotation (uses(Modelica(version="3.2"))); end BouncingBall; ``` -------------------------------- ### Verilog/SystemVerilog Code Example Source: https://github.com/assimon/dujiaoka/blob/master/public/vendor/dcat-admin/dcat/plugins/editor-md/lib/codemirror/mode/verilog/index.html Illustrates various Verilog and SystemVerilog constructs including literals, macro definitions, module definitions, class definitions, and tasks. ```verilog // Literals 1'b0 1'bx 1'bz 16'hDC78 'hdeadbeef 'b0011xxzz 1234 32'd5678 3.4e6 -128.7 ``` ```verilog // Macro definition `define BUS_WIDTH = 8; ``` ```verilog // Module definition module block( input clk, input rst_n, input [`BUS_WIDTH-1:0] data_in, output [`BUS_WIDTH-1:0] data_out ); always @(posedge clk or negedge rst_n) begin if (~rst_n) begin data_out <= 8'b0; end else begin data_out <= data_in; end if (~rst_n) data_out <= 8'b0; else data_out <= data_in; if (~rst_n) begin data_out <= 8'b0; end else begin data_out <= data_in; end end endmodule ``` ```verilog // Class definition class test; /** * Sum two integers */ function int sum(int a, int b); int result = a + b; string msg = $sformatf("%d + %d = %d", a, b, result); $display(msg); return result; endfunction task delay(int num_cycles); repeat(num_cycles) #1; endtask endclass ``` -------------------------------- ### Jinja2 Template Syntax Examples Source: https://github.com/assimon/dujiaoka/blob/master/public/vendor/dcat-admin/dcat/plugins/editor-md/lib/codemirror/mode/jinja2/index.html Illustrates various Jinja2 template constructs including comments, loops, variable output, conditional logic, and template includes. Useful for understanding Jinja2 syntax. ```jinja2 {# this is a comment #} {%- for item in li -%}
  • {{ item.label }}
  • {% endfor -%} {{ item.sand == true and item.keyword == false ? 1 : 0 }} {{ app.get(55, 1.2, true) }} {% if app.get('_route') == ('_home') %}home{% endif %} {% if app.session.flashbag.has('message') %} {% for message in app.session.flashbag.get('message') %} {{ message.content }} {% endfor %} {% endif %} {{ path('_home', {'section': app.request.get('section')}) }} {{ path('_home', { 'section': app.request.get('section'), 'boolean': true, 'number': 55.33 }) }} {% include ('test.incl.html.twig') %} ``` -------------------------------- ### Cypher Query Example Source: https://github.com/assimon/dujiaoka/blob/master/public/vendor/dcat-admin/dcat/plugins/editor-md/lib/codemirror/mode/cypher/index.html This is an example of Cypher query syntax. It demonstrates pattern matching, filtering, and returning data. ```cypher MATCH (joe { name: 'Joe' })-[:knows*2..2]-(friend_of_friend) WHERE NOT (joe)-[:knows]-(friend_of_friend) RETURN friend_of_friend.name, COUNT(*) ORDER BY COUNT(*) DESC , friend_of_friend.name ``` -------------------------------- ### Reattach to LNMP Installation Screen Session Source: https://github.com/assimon/dujiaoka/wiki/2.x_linux_install Use this command to reattach to a detached screen session where the LNMP installation is running. ```bash screen -r lnmp ``` -------------------------------- ### Create Database and User in MariaDB Source: https://github.com/assimon/dujiaoka/blob/master/debian_manual.md Connects to MariaDB and creates a new database, grants all privileges to a specified user, and flushes privileges. Replace placeholders with your desired values. ```sql CREATE DATABASE [这里替换为数据库名] ; GRANT ALL ON [这里替换为数据库名].* TO '[这里替换为用户名]'@'localhost' IDENTIFIED BY '[这里替换为密码]' WITH GRANT OPTION; FLUSH PRIVILEGES; EXIT ``` -------------------------------- ### HTML Mixed Mode Example Source: https://github.com/assimon/dujiaoka/blob/master/public/vendor/dcat-admin/dcat/plugins/editor-md/lib/codemirror/mode/htmlmixed/index.html An example of an HTML document with embedded CSS and JavaScript, intended for display within CodeMirror. ```html Mixed HTML Example

    Mixed HTML Example

    ``` -------------------------------- ### Hxml Mode Configuration Example Source: https://github.com/assimon/dujiaoka/blob/master/public/vendor/dcat-admin/dcat/plugins/editor-md/lib/codemirror/mode/haxe/index.html Shows a typical Hxml configuration line used for compiler arguments. This is relevant for setting up Hxml mode in CodeMirror. ```hxml -cp test -js path/to/file.js #-remap nme:flash --next -D source-map-content -cmd 'test' -lib lime ``` -------------------------------- ### Create MySQL Database Source: https://github.com/assimon/dujiaoka/wiki/2.x_linux_install Connects to the MySQL server and creates a new database named 'dujiaoka'. ```bash mysql -uroot -p create database dujiaoka; ``` -------------------------------- ### SCSS Example Code Source: https://github.com/assimon/dujiaoka/blob/master/public/vendor/dcat-admin/dcat/plugins/editor-md/lib/codemirror/mode/css/scss.html This is an example of SCSS code that demonstrates various features like variables, nesting, mixins, and extends. ```scss /* Some example SCSS */ @import "compass/css3"; $variable: #333; $blue: #3bbfce; $margin: 16px; .content-navigation { #nested { background-color: black; } border-color: $blue; color: darken($blue, 9%); } .border { padding: $margin / 2; margin: $margin / 2; border-color: $blue; } @mixin table-base { th { text-align: center; font-weight: bold; } td, th {padding: 2px} } table.hl { margin: 2em 0; td.ln { text-align: right; } } li { font: { family: serif; weight: bold; size: 1.2em; } } @mixin left($dist) { float: left; margin-left: $dist; } #data { @include left(10px); @include table-base; } .source { @include flow-into(target); border: 10px solid green; margin: 20px; width: 200px; } .new-container { @include flow-from(target); border: 10px solid red; margin: 20px; width: 200px; } body { margin: 0; padding: 3em 6em; font-family: tahoma, arial, sans-serif; color: #000; } @mixin yellow() { background: yellow; } .big { font-size: 14px; } .nested { @include border-radius(3px); @extend .big; p { background: whitesmoke; a { color: red; } } } #navigation a { font-weight: bold; text-decoration: none !important; } h1 { font-size: 2.5em; } h2 { font-size: 1.7em; } h1:before, h2:before { content: "::"; } code { font-family: courier, monospace; font-size: 80%; color: #418A8A; } ``` -------------------------------- ### YAML Complex Data Structure Example Source: https://github.com/assimon/dujiaoka/blob/master/public/vendor/dcat-admin/dcat/plugins/editor-md/lib/codemirror/mode/yaml/index.html A comprehensive example showcasing nested structures, aliases, anchors, and multi-line strings in YAML. ```yaml receipt: Oz-Ware Purchase Invoice date: 2007-08-06 customer: given: Dorothy family: Gale items: - part_no: A4786 descrip: Water Bucket (Filled) price: 1.47 quantity: 4 - part_no: E1628 descrip: High Heeled "Ruby" Slippers size: 8 price: 100.27 quantity: 1 bill-to: &id001 street: | 123 Tornado Alley Suite 16 city: East Centerville state: KS ship-to: *id001 specialDelivery: > Follow the Yellow Brick Road to the Emerald City. Pay no attention to the man behind the curtain. ... ```