반응형

보통 이미지 뷰어는 투명 영역을 체크무늬나 검정색으로 표시한다. 이미지의 투명한 영역이 투과되어 보이는 이미지 뷰어를 사용해 보자.


투명 배경에 흰색 글자가 표시되어 있다. 흰색 배경의 브라우저를 사용한다면 위 이미지가 보이지 않는다.


pqiv를 설치한다.


pqiv -c -i -P '50, 50' sean.png 명령을 실행한다. '&' 옵션을 주지 않아도 백그라운드로 실행된다.


-c, --transparent-background

Draw pqiv's window borderless and transparent. In window mode, a mouse click activates and deactivates window decorations.


-i, --hide-info-box

Initially hide the infobox. Whether the box is visible can be toggled by pressing 'i' at runtime by default.


-P, --window-position=POSITION

Set the initial window position. POSITION may either be 'x,y'  screen coordinates or 'off' to not position the window at all.


그 외 옵션은 Ubuntu Manpage를 참고하자.


반응형
Posted by J-sean
:
반응형

리눅스(우분투)에 설치된 비주얼 스튜디오에서 파이썬을 프로그래밍해보자.


pip가 설치되지 않았다면 설치한다.


폴더를 만들어 준다.


폴더내에 파이썬 소스를 작성할 파일을 만든다. 확장자는 .py로 한다.


Python extension을 설치한다.



Linter pylint가 설치되지 않았다는 메세지가 나온다. Install 한다.


소스를 입력하고 Ctrl+F5키를 누르면 실행된다.

Run - Run Without Debugging을 선택해도 된다.


반응형
Posted by J-sean
:
반응형

리눅스(우분투)에서 비주얼 스튜디오 코드를 설치하고 코딩해 보자.


비주얼 스튜디오 홈페이지에 접속하고 Debian, Ubuntu용 .deb을 선택한다.


설치파일을 다운로드한다.


다운로드한 설치파일을 실행한다.


Install을 선택한다.



설치는 간단히 끝난다.


build-essential을 설치한다.


설치된 Visual Studio Code를 실행한다.


Welcome 화면이 나타난다.



File - Open Folder... 를 선택한다.


원하는 폴더를 만들고 선택한다.


EXPLORER - 위에서 만든 폴더에서 New File을 선택한다.


원하는 파일이름을 지정한다. C++ 프로그램을 만들기 위해 확장자는 .cpp로 지정한다.



Extensions에서 c/c++를 설치한다.


간단한 C++ 코드를 입력한다.


Terminal - Configure Default Build Task...를 선택한다.


C/C++: g++ build active file을 선택한다.



Terminal - Run Build Task...를 선택한다.


빌드가 진행된다.


위에서 만든 폴더로 가면 빌드된 파일이 있다. 실행해 본다.


task를 변경하고 싶다면 아래 예처럼 tasks.json 파일을 변경한다.



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
{
    "version""2.0.0",
    "runner""terminal",
    "type""shell",
    "echoCommand"true,
    "presentation": {
        "reveal""always"
    },
    "tasks": [
        // C++
        {
            "label""save and compile for C++",
            "command""g++",
            "args": [
                "${file}",
                "-o",
                "${fileDirname}/${fileBasenameNoExtension}"
            ],
            "group""build",
            "problemMatcher": {
                "fileLocation": [
                    "relative",
                    "${workspaceRoot}"
                ],
                "pattern": {
                    "regexp""^(.*):(\\d+):(\\d+):\\s+(warning error):\\s+(.*)$",
                    "file"1,
                    "line"2,
                    "column"3,
                    "severity"4,
                    "message"5
                }
            }
        },
        // C
        {
            "label""save and compile for C",
            "command""gcc",
            "args": [
                "${file}",
                "-o",
                "${fileDirname}/${fileBasenameNoExtension}"
            ],
            "group""build",
            "problemMatcher": {
                "fileLocation": [
                    "relative",
                    "${workspaceRoot}"
                ],
                "pattern": {
                    "regexp""^(.*):(\\d+):(\\d+):\\s+(warning error):\\s+(.*)$",
                    "file"1,
                    "line"2,
                    "column"3,
                    "severity"4,
                    "message"5
                }
            }
        },
        {
            "label""execute",
            "command""cd ${fileDirname} && ./${fileBasenameNoExtension}",
            "group""test"
        }
    ]
}


tasks.json 예제


필요하다면 File -Preferences - Keyboard Shortcuts 에서 새로만든 task의 단축키를 지정할 수 있다.


Open Keyboard Shortcuts (JSON) 아이콘을 클릭한다.


아래 예처럼 keybindings.json 파일을 수정한다.



1
2
3
4
5
6
7
[
    // Compile
    { "key""ctrl+shift+1""command""workbench.action.tasks.build" },
 
    // Execute
    { "key""ctrl+shift+2""command""workbench.action.tasks.test" }
]


keybidings.json 예제


반응형
Posted by J-sean
:
반응형

리눅스(우분투) 서버에 X Window(GUI)를 설치해 보자.


sudo apt update를 실행해서 package list를 업데이트한다.


업데이트가 완료되면 sudo apt upgrade를 실행해서 package를 upgrade/install/remove한다.


sudo apt install ubuntu-desktop-minimal 명령으로 X Window 설치를 진행한다.


sudo apt install ubuntu-desktop-minimal: 최소 설치

sudo apt install ubuntu-desktop: 전체 설치


1,695 MB의 디스크 공간이 필요하다. 설치는 꽤 오랫동안 진행된다.



설치가 완료되면 startx 명령어로 X Window를 실행한다.


Welcome! 이라고 한다.


키보드를 선택한다.


내 위치정보를 공개할지 선택한다.



간단한 설정이 완료되었다.


재부팅이 필요하다.


재부팅하면 바로 X Window가 실행된다. 로그인 하자.


X Window 화면이 나타난다.



부팅시 X Window가 자동 실행되지 않도록 하려면 아래 명령어를 입력한다.


sudo systemctl set-default multi-user


부팅시 다시 X Window가 자동 실행되게 하려면 아래 명령어를 입력한다.


sudo systemctl set-default graphical


직접 Run Level을 변경해 X Window 자동 실행 여부를 결정할 수 도 있다. 현재 default.target은 graphical.target을 가리키고 있다.


multi-user.target을 가리키도록 변경한다.



재부팅하면 X Window가 아닌 Console로 부팅된다.


startx를 실행하면 약간 다른 모양의 X Window가 실행된다.


Log Out 해 보자.


다시 콘솔 화면으로 돌아간다.


X Window로 부팅하려면 아래 명령어를 입력한다.

sudo ln -sf /lib/systemd/system/graphical.target /lib/sytemd/system/default.target


반응형
Posted by J-sean
:
반응형

Samba is the standard Windows interoperability suite of programs for Linux and Unix.

Since 1992, Samba has provided secure, stable and fast file and print services for all clients using the SMB/CIFS protocol, such as all versions of DOS and Windows, OS/2, Linux and many others.


This post describes how to create a public share on Samba in Fedora Linux.


Samba를 이용해 윈도우에서도 접속 가능한 리눅스 공유 폴더를 간단히 만들 수 있다. 사용자 이름이나 암호 없이 접속 가능한 간단한 공유 폴더를 만들어 보자.


Download and install Samba package.


Edit '/etc/samba/smb.conf'


Add the following in [global].

netbios name = sean

map to guest = Bad User


Make [share] at the end and add the following in it.

path = /share

public = yes

writable = yes


Run 'testparm' and check 'smb.conf'.


Move to the root directory and make a directory you want to share.

The name of the sharing directory has to be the same as the name you assigned to 'path' in 'smb.conf' [share].


※ 'share' has read and execute permissions only for 'other'. So if you access it as an 'other', you can't write to it unless you give write permission to 'other'. (chmod 777 share)



Add Samba service to the firewall and reload it.


Start and enable Samba. To start services automatically at boot, you must enable them.


Run 'File Explorer' in Windows and access to the sharing directory in Linux by its IP address.


You can also access the directory by the name you assigned to 'netbios name' in 'smb.conf' [global]


반응형
Posted by J-sean
:
반응형

Python comes preinstalled on most Linux distributions and is available as a package on all others. However, there are certain features you might want to use that are not available on your distro’s package. You can easily compile the latest version of Python from the source.


대부분의 리눅스에는 파이썬이 포함되어 있어 바로 사용할 수 있지만 최신 버전의 파이썬 소스를 직접 컴파일해 사용할 수 도 있다.


파이썬 홈페이지에서 소스 파일 링크 주소를 확인 한다.


wget으로 소스코드를 다운 받는다.


다운 받은 소스 코드 확인.


--enable-optimizations 옵션과 함께 configure를 실행 한다.


make가 없다면 설치 한다.



make로 컴파일 한다. 지정된 디렉토리에 설치 하고 싶다면 make 실행 후 make altinstall 까지 진행 한다.


Warning: make install can overwrite or masquerade the python3 binary. make altinstall is therefore recommended instead of make install since it only installs exec_prefix/bin/pythonversion.


exec_prefix (${exec_prefix}) is installation-dependent and should be interpreted as for GNU software. For example, on most Linux systems, the default is /usr.


./python을 실행하면 컴파일된 파이썬이 실행 된다.


간단히 python명령어로 실행하기 위해 /usr/bin에 소프트 링크를 만들어 준다.


파이썬 홈페이지에서 다운 받았던 압축 파일은 삭제 한다.


dnf로 최신 버전 파이썬을 간단히 설치 할 수 도 있다.



설치가 완료되면 파이썬[버전] 형식으로 실행 할 수 있다.


Python package installer인 pip도 설치 한다. 


pip3 --version 명령으로 pip버전을 확인할 수 있다.


반응형
Posted by J-sean
:
반응형

Explains how to install MariaDB in Fedora Linux.

 

2021.08.28 - [Linux] - Linux(Ubuntu) MariaDB(MySQL) Server Remote Access - 데이터베이스 원격 접

 

Generate custom MariaDB YUM repository under '/etc/yum.repos.d/' and name the file 'MariaDB.repo' or something similar.

 

Setting up MariaDB Repositories

 

With the repo file in place, MariaDB can be installed with:

sudo dnf install MariaDB-server

 

Start and enable the service.

 

Open MariaDB Server port.

 

 

 

continues.......

 

 

 

 

 

 

 

반응형
Posted by J-sean
:
반응형

구글 클라우드 플랫폼으로 간단한 무료 웹 서버를 만들 수 있다.

 

2021.09.04 - [Linux] - GCP Compute Engine - 구글 클라우드 컴퓨트 엔진

 

 

 

구글 클라우드 플렛폼에 가입한다.

 

왼쪽 메뉴에서 Compute Engine - VM 인스턴스를 클릭한다.

 

만들기를 클릭한다.

 

무료로 만들 수 있는 Compute Engine은 위와 같은 조건이 있지만 간단한 웹서버를 만들기에는 충분한 조건이다.

 

 

 

원하는 이름을 지정한다. 지역은 오리건, 머신 유형은 f1-micro, 부팅 디스크는 30GB 표준 영구 디스크에 CentOS 8 로 설정 했다.

방화벽에 HTTP 트래픽 허용, HTTPS 트래픽 허용을 체크하고 만들기 버튼을 클릭한다.

 

VM 인스턴스에 sean-server가 생성 되었다. 연결 - SSH를 클릭한다.

 

CentOS Linux에 SSH로 연결 되었다. Apache등을 설치하고 서버로 만들어 준다.

 

2019/10/08 - [Software/Linux] - Build your own web server with Fedora linux - 페도라 리눅스로 간단한 웹서버 만들기

 

 

반응형
Posted by J-sean
: