トップ 差分 一覧 ソース 検索 ヘルプ PDF RSS ログイン

*tmp*


VSCode

curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo install -o root -g root -m 644 microsoft.gpg /etc/apt/trusted.gpg.d/
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'
sudo apt install apt-transport-https
sudo apt update
sudo apt install code

RasPi

Ubuntu

$ sudo add-apt-repository ppa:graphics-drivers/ppa
$ sudo add-apt-repository --remove ppa:graphics-drivers/ppa

bash prompt (with line feed)

PS1="[\t]\u@\H:\w\n$ "

MicroPython

esptool.py --chip esp32 --port COM3 --baud 460800 write_flash -z 0x1000 esp32-20191002-v1.11-381-g4102320e9.bin

MSYS2 default prompt

PS1='\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[35m\]$MSYSTEM\[\e[0m\] \[\e[33m\]\w\[\e[0m\]\n\$ '

gnome-terminal が起動しない問題 (on Linux Mint)

% /usr/lib/gnome-terminal/gnome-terminal-server &
% gnome-terminal &


  • C:\VMware\LinuxMint18.1 (2018.5.31)
    • 13.8GB
  • C:\VMware\ubujwu
    • 14.6GB
(base) C:\Windows\system32>anaconda -V
anaconda Command line client (version 1.6.9)

(base) C:\Windows\system32>python --version
Python 3.6.4 :: Anaconda, Inc.

C:\usr\MinGW\bin
C:\Users\yokotay>gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=c:/usr/mingw/bin/../libexec/gcc/mingw32/5.3.0/lto-wrapper.exe
Target: mingw32
Configured with: ../src/gcc-5.3.0/configure --build=x86_64-pc-linux-gnu --host=mingw32 --prefix=/mingw --disable-win32-registry --target=mingw32 --with-arch=i586 --enable-languages=c,c++,objc,obj-c++,fortran,ada --enable-static --enable-shared --enable-threads - -with-dwarf2 --disable-sjlj-exceptions --enable-version-specific-runtime-libs --with-libintl-prefix=/mingw --enable-libstdcxx-debug --with-tune=generic --enable-libgomp --disable-libvtv --enable-nls : (reconfigured) ../src/gcc-5.3.0/configure --build=x86_64-pc-linux-gnu --host=mingw32 --prefix=/mingw --disable-win32-registry --target=mingw32 --with-arch=i586 --enable-languages=c,c++,objc,obj-c++,fortran,ada --enable-static --enable-shared --enable-threads --with-dwarf2 --disable-sjlj-exceptions --enable-version-specific-runtime-libs --with-libiconv-prefix=/mingw --with-libintl-prefix=/mingw --enable-libstdcxx-debug --with-tune=generic --enable-libgomp --disable-libvtv --enable-nls
Thread model: win32
gcc version 5.3.0 (GCC)

C:\Users\yokotay>gcc --version
gcc (GCC) 5.3.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
C:\Users\yokotay>echo %PATH%
C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\ImageMagick-6.8.6-Q16;C:\Program Files (x86)\MEGA6;C:\ProgramData\Oracle\Java\javapath;C:\usr\Perl64\site\bin;C:\usr\Perl64\bin;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\OEM\12.0\DLLShared\;C:\Program Files (x86)\Roxio 2010\OEM\AudioCore\;C:\usr\MinGW\bin;C:\Program Files\Git\cmd;C:\Program Files\TortoiseGit\bin;C:\Program Files\opencv\build\x64\vc14\bin;C:\Program Files (x86)\Skype\Phone\;C:\Applied Biosystems\SeqScanner\bin;C:\usr\Python;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\QuickTime\QTSystem\;C:\texlive\2013\bin\win32;C:\Program Files\Java\jdk1.8.0_181\bin;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\1041;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\VDT;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcpackages;C:\Windows\Microsoft.NET\Framework64\v2.0.50727;C:\Windows\Microsoft.NET\Framework64\v3.5;C:\Windows\Microsoft.NET\Framework64\v4.0.30319;C:\usr\MinGW\lib;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\usr\Python\Scripts\;C:\usr\Python\;C:\Users\yokotay\AppData\Local\Microsoft\WindowsApps

Anaconda & OpenCV

Anaconda起動時トラブル

起動時にエラーが出る場合がある。Windowsを再起動すると直ることが多い。
原因不明。今後調査。

OpenCVインストール失敗

下記を実行すると

import cv2
print(cv2.__version__)

import cv2 時点で下記エラーが出る。

ImportError: DLL load failed: アクセスが拒否されました。

DLLファイルのアクセス権限設定がおかしくなっている(読み込むことができない)可能性あり。今後調査し、対象ファイルを見つける。

  • C:\ProgramData\Anaconda3\Library\bin 以下にあるOpenCV関連のDLLファイルのアクセス権限設定がまずく、一般ユーザの「読み取り・実行」権限が付いていなかった。
  • binフォルダでセキュリティの詳細設定→アクセス許可の変更→「子オブジェクトのアクセス許可エントリすべてを、このオブジェクトからの継承可能なアクセス許可エントリで置き換える」にチェックを入れ「適用」

参考:

関連ディレクトリ:

  • C:\ProgramData\Anaconda3\pkgs\opencv-3.3.1-py36h20b85fd_1
  • C:\ProgramData\Anaconda3\Library\include\opencv2

Tools:

アクセス権の省略型表示
表示	意味
F	フルコントロール。すべての操作が対象となる
W	書き込み可能
R	読み出しのみ可能
C	変更(書き込み)可能
N	アクセス権なし

python debug

import pdb; pdb.set_trace()

  • Anaconda Prompt 起動、Zドライブに移動
  • テキストエディタでファイル作成(Zドライブ上、日語文字コードはUTF-8)
  • プロンプト上で "python myfile.py" の形で実行
(base) Z:\python>python mytest1.py
Traceback (most recent call last):
  File "mytest1.py", line 1, in <module>
    from numpy.random import *
  File "C:\ProgramData\Anaconda3\lib\site-packages\numpy\__init__.py", line 126, in 
<module>
    from numpy.__config__ import show as show_config
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 674, in exec_module
  File "<frozen importlib._bootstrap_external>", line 780, in get_code
  File "<frozen importlib._bootstrap_external>", line 832, in get_data
PermissionError: [Errno 13] Permission denied: 
'C:\\ProgramData\\Anaconda3\\lib\\site-packages\\numpy\\__config__.py'

$ cat touchpad-off.sh 
xinput set-prop "FocalTechPS/2 FocalTech Touchpad" --type=int --format=8 "Device Enabled" 0
$ cat touchpad-on.sh 
xinput set-prop "FocalTechPS/2 FocalTech Touchpad" --type=int --format=8 "Device Enabled" 1 

package.json (nodetest1) @ mp-spc02 (2017/10/7)

{
 "name": "nodetest1",
 "version": "0.0.0",
 "private": true,
 "scripts": {
   "start": "node ./bin/www"
 },
 "dependencies": {
   "body-parser": "~1.18.2",
   "cookie-parser": "~1.4.3",
   "debug": "~2.6.9",
   "express": "~4.15.5",
   "jade": "~1.11.0",
   "morgan": "~1.9.0",
   "serve-favicon": "~2.4.5"
 }
}
Z:\webapp\nodetest1>npm install
npm WARN deprecated jade@1.11.0: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN deprecated transformers@2.1.0: Deprecated, use jstransformer
nodetest1@0.0.0 Z:\webapp\nodetest1
+-- body-parser@1.18.2
| +-- bytes@3.0.0
| +-- content-type@1.0.4
| +-- depd@1.1.1
| +-- http-errors@1.6.2
| | `-- inherits@2.0.3
| +-- iconv-lite@0.4.19
| +-- on-finished@2.3.0
| | `-- ee-first@1.1.1
| +-- qs@6.5.1
| +-- raw-body@2.3.2
| | `-- unpipe@1.0.0
| `-- type-is@1.6.15
|   +-- media-typer@0.3.0
|   `-- mime-types@2.1.17
|     `-- mime-db@1.30.0
+-- cookie-parser@1.4.3
| +-- cookie@0.3.1
| `-- cookie-signature@1.0.6
+-- debug@2.6.9
| `-- ms@2.0.0
+-- express@4.15.5
| +-- accepts@1.3.4
| | `-- negotiator@0.6.1
| +-- array-flatten@1.1.1
| +-- content-disposition@0.5.2
| +-- encodeurl@1.0.1
| +-- escape-html@1.0.3
| +-- etag@1.8.1
| +-- finalhandler@1.0.6
| +-- fresh@0.5.2
| +-- merge-descriptors@1.0.1
| +-- methods@1.1.2
| +-- parseurl@1.3.2
| +-- path-to-regexp@0.1.7
| +-- proxy-addr@1.1.5
| | +-- forwarded@0.1.2
| | `-- ipaddr.js@1.4.0
| +-- qs@6.5.0
| +-- range-parser@1.2.0
| +-- send@0.15.6
| | +-- destroy@1.0.4
| | `-- mime@1.3.4
| +-- serve-static@1.12.6
| +-- setprototypeof@1.0.3
| +-- statuses@1.3.1
| +-- utils-merge@1.0.0
| `-- vary@1.1.2
+-- jade@1.11.0
| +-- character-parser@1.2.1
| +-- clean-css@3.4.28
| | +-- commander@2.8.1
| | | `-- graceful-readlink@1.0.1
| | `-- source-map@0.4.4
| |   `-- amdefine@1.0.1
| +-- commander@2.6.0
| +-- constantinople@3.0.2
| | `-- acorn@2.7.0
| +-- jstransformer@0.0.2
| | +-- is-promise@2.1.0
| | `-- promise@6.1.0
| |   `-- asap@1.0.0
| +-- mkdirp@0.5.1
| | `-- minimist@0.0.8
| +-- transformers@2.1.0
| | +-- css@1.0.8
| | | +-- css-parse@1.0.4
| | | `-- css-stringify@1.0.5
| | +-- promise@2.0.0
| | | `-- is-promise@1.0.1
| | `-- uglify-js@2.2.5
| |   +-- optimist@0.3.7
| |   | `-- wordwrap@0.0.3
| |   `-- source-map@0.1.43
| +-- uglify-js@2.8.29
| | +-- source-map@0.5.7
| | +-- uglify-to-browserify@1.0.2
| | `-- yargs@3.10.0
| |   +-- camelcase@1.2.1
| |   +-- cliui@2.1.0
| |   | +-- center-align@0.1.3
| |   | | +-- align-text@0.1.4
| |   | | | +-- kind-of@3.2.2
| |   | | | | `-- is-buffer@1.1.5
| |   | | | +-- longest@1.0.1
| |   | | | `-- repeat-string@1.6.1
| |   | | `-- lazy-cache@1.0.4
| |   | +-- right-align@0.1.3
| |   | `-- wordwrap@0.0.2
| |   +-- decamelize@1.2.0
| |   `-- window-size@0.1.0
| +-- void-elements@2.0.1
| `-- with@4.0.3
|   +-- acorn@1.2.2
|   `-- acorn-globals@1.0.9
+-- mongodb@2.2.31
| +-- es6-promise@3.2.1
| +-- mongodb-core@2.1.15
| | +-- bson@1.0.4
| | `-- require_optional@1.0.1
| |   +-- resolve-from@2.0.0
| |   `-- semver@5.4.1
| `-- readable-stream@2.2.7
|   +-- buffer-shims@1.0.0
|   +-- core-util-is@1.0.2
|   +-- isarray@1.0.0
|   +-- process-nextick-args@1.0.7
|   +-- string_decoder@1.0.3
|   `-- util-deprecate@1.0.2
+-- monk@4.1.0
| `-- gitbook-plugin-github@2.0.0
+-- morgan@1.9.0
| +-- basic-auth@2.0.0
| `-- on-headers@1.0.1
`-- serve-favicon@2.4.5
  `-- safe-buffer@5.1.1


Z:\webapp\nodetest1>
 ドライブ Z のボリューム ラベルは yokota2 です
 ボリューム シリアル番号は 26E1-AB1F です

 Z:\webapp\nodetest1\node_modules のディレクトリ

2017/10/07  20:08    <DIR>          .
2017/10/07  20:15    <DIR>          ..
2017/10/07  20:08    <DIR>          accepts
2017/10/07  20:08    <DIR>          acorn
2017/10/07  20:08    <DIR>          acorn-globals
2017/10/07  20:08    <DIR>          align-text
2017/10/07  20:08    <DIR>          amdefine
2017/10/07  20:08    <DIR>          array-flatten
2017/10/07  20:08    <DIR>          asap
2017/10/07  20:08    <DIR>          basic-auth
2017/10/07  20:08    <DIR>          body-parser
2017/10/07  20:08    <DIR>          bson
2017/10/07  20:08    <DIR>          buffer-shims
2017/10/07  20:08    <DIR>          bytes
2017/10/07  20:08    <DIR>          camelcase
2017/10/07  20:08    <DIR>          center-align
2017/10/07  20:08    <DIR>          character-parser
2017/10/07  20:08    <DIR>          clean-css
2017/10/07  20:08    <DIR>          cliui
2017/10/07  20:08    <DIR>          commander
2017/10/07  20:08    <DIR>          constantinople
2017/10/07  20:08    <DIR>          content-disposition
2017/10/07  20:08    <DIR>          content-type
2017/10/07  20:08    <DIR>          cookie
2017/10/07  20:08    <DIR>          cookie-parser
2017/10/07  20:08    <DIR>          cookie-signature
2017/10/07  20:08    <DIR>          core-util-is
2017/10/07  20:08    <DIR>          css
2017/10/07  20:08    <DIR>          css-parse
2017/10/07  20:08    <DIR>          css-stringify
2017/10/07  20:08    <DIR>          debug
2017/10/07  20:08    <DIR>          decamelize
2017/10/07  20:08    <DIR>          depd
2017/10/07  20:08    <DIR>          destroy
2017/10/07  20:08    <DIR>          ee-first
2017/10/07  20:08    <DIR>          encodeurl
2017/10/07  20:08    <DIR>          es6-promise
2017/10/07  20:08    <DIR>          escape-html
2017/10/07  20:08    <DIR>          etag
2017/10/07  20:08    <DIR>          express
2017/10/07  20:08    <DIR>          finalhandler
2017/10/07  20:08    <DIR>          forwarded
2017/10/07  20:08    <DIR>          fresh
2017/10/07  20:08    <DIR>          gitbook-plugin-github
2017/10/07  20:08    <DIR>          graceful-readlink
2017/10/07  20:08    <DIR>          http-errors
2017/10/07  20:08    <DIR>          iconv-lite
2017/10/07  20:08    <DIR>          inherits
2017/10/07  20:08    <DIR>          ipaddr.js
2017/10/07  20:08    <DIR>          isarray
2017/10/07  20:08    <DIR>          is-buffer
2017/10/07  20:08    <DIR>          is-promise
2017/10/07  20:08    <DIR>          jade
2017/10/07  20:08    <DIR>          jstransformer
2017/10/07  20:08    <DIR>          kind-of
2017/10/07  20:08    <DIR>          lazy-cache
2017/10/07  20:08    <DIR>          longest
2017/10/07  20:08    <DIR>          media-typer
2017/10/07  20:08    <DIR>          merge-descriptors
2017/10/07  20:08    <DIR>          methods
2017/10/07  20:08    <DIR>          mime
2017/10/07  20:08    <DIR>          mime-db
2017/10/07  20:08    <DIR>          mime-types
2017/10/07  20:08    <DIR>          minimist
2017/10/07  20:08    <DIR>          mkdirp
2017/10/07  20:08    <DIR>          mongodb
2017/10/07  20:08    <DIR>          mongodb-core
2017/10/07  20:08    <DIR>          monk
2017/10/07  20:08    <DIR>          morgan
2017/10/07  20:08    <DIR>          ms
2017/10/07  20:08    <DIR>          negotiator
2017/10/07  20:08    <DIR>          on-finished
2017/10/07  20:08    <DIR>          on-headers
2017/10/07  20:08    <DIR>          optimist
2017/10/07  20:08    <DIR>          parseurl
2017/10/07  20:08    <DIR>          path-to-regexp
2017/10/07  20:08    <DIR>          process-nextick-args
2017/10/07  20:08    <DIR>          promise
2017/10/07  20:08    <DIR>          proxy-addr
2017/10/07  20:08    <DIR>          qs
2017/10/07  20:08    <DIR>          range-parser
2017/10/07  20:08    <DIR>          raw-body
2017/10/07  20:08    <DIR>          readable-stream
2017/10/07  20:08    <DIR>          repeat-string
2017/10/07  20:08    <DIR>          require_optional
2017/10/07  20:08    <DIR>          resolve-from
2017/10/07  20:08    <DIR>          right-align
2017/10/07  20:08    <DIR>          safe-buffer
2017/10/07  20:08    <DIR>          semver
2017/10/07  20:08    <DIR>          send
2017/10/07  20:08    <DIR>          serve-favicon
2017/10/07  20:08    <DIR>          serve-static
2017/10/07  20:08    <DIR>          setprototypeof
2017/10/07  20:08    <DIR>          source-map
2017/10/07  20:08    <DIR>          statuses
2017/10/07  20:08    <DIR>          string_decoder
2017/10/07  20:08    <DIR>          transformers
2017/10/07  20:08    <DIR>          type-is
2017/10/07  20:08    <DIR>          uglify-js
2017/10/07  20:08    <DIR>          uglify-to-browserify
2017/10/07  20:08    <DIR>          unpipe
2017/10/07  20:08    <DIR>          util-deprecate
2017/10/07  20:08    <DIR>          utils-merge
2017/10/07  20:08    <DIR>          vary
2017/10/07  20:08    <DIR>          void-elements
2017/10/07  20:08    <DIR>          window-size
2017/10/07  20:08    <DIR>          with
2017/10/07  20:08    <DIR>          wordwrap
2017/10/07  20:08    <DIR>          yargs
               0 個のファイル                   0 バイト
             109 個のディレクトリ  1,236,300,615,680 バイトの空き領域

  • Ubuntu & ATOM
    • sudo add-apt-repository ppa:webupd8team/atom
    • sudo apt-get update
    • sudo apt-get install atom

Drone

UNIX BUILD
Linux: Tested on Ubuntu 12.10, 13.04, 13.10 and 14.04
OSX: Tested on 10.10.5
This script is deprecated and doesn't work anymore.

Please download repo (http://source.android.com/source/downloading.html#installing-repo).
Then run 'repo init -u https://github.com/Parrot-Developers/arsdk_manifests.git' in an empty folder.
Then run 'repo sync' to get all sources.
After that, you'll be able to run './build.sh' to build the SDK.

git config --global user.email "..."
git config --global user.name "..."
repo init -u https://github.com/Parrot-Developers/arsdk_manifests.git
repo sync
(197MB)
sudo apt-get install libavahi-client-dev  
sudo apt-get install autoconf
sudo apt-get install libtool
sudo apt-get install libavcodec-dev
sudo apt-get install libavformat-dev
sudo apt-get install libswscale-dev
sudo apt-get install libncurses5-dev
./build.sh -p arsdk-native -t build-sdk -j
(445MB)
date; ./build.sh -p arsdk-native -t build-sample -j; date
(448MB)

Music

LIFEBOOK Touchpad & Ubuntu

LIFEBOOK E554/J + Ubuntu 14.04 (64bit) において,下記メッセージが出て,タッチパッドが認識せず,かつキーボードもまともに動作しない(突然入力したキーの無限リピートが発生する)問題あり.

psmouse serio2: Touchpad at isa0060/serio2/input0 lost sync at byte 6

psmouse.proto=bare を指定することで問題が解消することを確認(カーネル3.13, 3.16, 3.17, 3.18).

対処法(1): GRUBメニューの修正

$ sudo emacs /etc/default/grub
 GRUB_CMDLINE_LINUX_DEFAULT="quiet splash psmouse.proto=bare"
$ sudo update-grub

対処法(2): その都度コマンドラインで対処

sudo rmmod psmouse
sudo modprobe psmouse proto=bare
  • 参考:Bug 48161 - Elantech Touchpad lost sync and becomes unusable

メモなど:

$ dmesg|grep elan
[    2.717525] psmouse serio2: elantech: assuming hardware version 4 (with firmware version 0x570f01)
[    2.752493] psmouse serio2: elantech: Synaptics capabilities query result 0x40, 0x14, 0x0c.
$ cat /proc/bus/input/devices |less

I: Bus=0011 Vendor=0002 Product=000e Version=0000
N: Name="ETPS/2 Elantech Touchpad"
P: Phys=isa0060/serio2/input0
S: Sysfs=/devices/platform/i8042/serio2/input/input9
U: Uniq=
H: Handlers=mouse2 event7
B: PROP=1
B: EV=b
B: KEY=e420 30000 0 0 0 0
B: ABS=661800011000003
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash i8042.notimeout i8042.nomux"

-

ccqpt040
00:24:D2:F0:96:4C

grub

GRUB_DEFAULT="Windows 7 (loader) (on /dev/sda1)"

Anthy

Emacs 24.3.1 + anthy-el でのトラブル対処

Misc.

/etc/udev/rules.d というディレクトリに
51-usbblaster.rules というファイル名で以下の内容のファイルを作る

ATTR{idVendor}=="09fb",ATTR{idProduct}=="6001",MODE="666"

利用するユーザの個人環境で以下が必要

export QUARTUS_64BIT=1
export PATH=$PATH:/opt/altera/13.1/quartus/bin

Ubuntu

cc602admin@ccrpt080:~$ sudo grub-install /dev/sda
/usr/sbin/grub-setup: warn: This GPT partition label has no BIOS Boot Partition; embedding won't be possible!.
/usr/sbin/grub-setup: warn: Embedding is not possible.  GRUB can only be installed in this setup by using blocklists.  However, blocklists are UNRELIABLE and their use is discouraged..
/usr/sbin/grub-setup: error: will not proceed with blocklists.

xorg.conf memo

http://www.maroontress.com/KanaKey/ + modification

Section "InputDevice"
        Identifier  "Keyboard0"
        Driver      "kbd"
        Option      "XkbRules" "xorg"
        Option      "XkbModel" "jp106"
        Option      "XkbLayout" "jp"
#        Option      "XkbOptions" "japan:kana,grp_led:scroll"
  	 Option	    "XkbOptions" "ctrl:swapcaps"
EndSection

プロ技デバッガデモサンプル

sum.c

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char* argv[])
{
	int n;
	int sum;
	int i;

	if (argc != 2) {
		fprintf(stderr, "Usage: %s n\n", argv[0]);
		exit(1);
	}
	n = atoi(argv[1]);
	sum = 0;
	for (i = 1; i <= n; i++) {
		sum = sum + i;
	}
	printf("sum of 1 to %d is %d\n", n, sum);
	exit(0);
}

sum-err1.c

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char* argv[])
{
	int n        /* */
    int sum;
	int i;

	if (argc != 2) {
		fprintf(stderr, "Usage: %s n\n", argv[0]);
		exit(1);
	}
	n = atoi(argv[1]);
	sum = 0;
	for (i = 1; i <= n; i++) {
		sum = sum + i;
	}
	printf("sum of 1 to %d is %d\n", n, sum);
	exit(0);
}

leapYear.c

#include <stdio.h>

int checkLeapYear(int year);

int main(void)
{
	int myYear;

	myYear = 1986;
	if (checkLeapYear(myYear) == 1)
		printf("%d is a leap year\n", myYear);
	else
		printf("%d is not a leap year\n", myYear);

	return 0;
}

int checkLeapYear(int year)
{
	if (year % 400 == 0) return 1;
	else if (year % 100 == 0) return 0;
	else if (year % 4 == 0) return 1;
	else return 0;
}