- Docker
- 가장 빨리 만나는 docker http://pyrasis.com/docker.html
- Docker architecture
- APUE(Advanced Programming in UNIX environment)
- 1.7 Error Handling
- Mastering Apache Maven3
- POM extending and overriding
- Linux Network Administrator's Guide, Second Edition
- Chapter 3. Configuring the Networking Hardware
- 가장 빨리 만나는 GO 언어
- Unit 17 for 반복문 사용하기
- 9가지 사례로 익히는 고급 스파크 분석
- Chapter 3
- sed(stream editor)
- 고급 Bash 스크립팅 가이드
- learning spark
- 1회독
- the linux command line
- mapreduce
- mapreduce-osdi04.pdf
- Functional Programming in Scala
- Bash Shell Script
- Expert Hadoop Administration
- Managing and Protecting Hadoop Data and High Availability
- YDKJS
- Linux Kernel Development
- "12. Memory management" 먼저 읽어보는 중, Per-CPU Data at Compile-Time 부터
- Java concurrency in practice
- "3. Sharing object"
- react native
- 공식 홈페이지 document 참고: https://facebook.github.io/react-native/docs/getting-started
More resources
까지 읽음.GUIDE
이하 읽을 차례
- UNIX and Linux System Administration Handbook, 5th Edition
study's Introduction
study's People
Forkers
myae3080study's Issues
hovering 으로 이미지 띄우기
Effectiveness, efficiency, satisfaction, reactive, usability, delegation and etc.
ctrl-c vs. ctrl-d in unix
python vars
npm request 관련
설치: npm install request
var somevariable;
request('url', function(error, response, body) {
somevariable = JSON.parse(body)['item'];
}
request('url', function(error, response, body) {
console.log(somevariable);
}
두번째 호출에서 전역변수인 somevariable을 쓰려고 하였으나, 값이 없는 상태가 되버린다.
-> 순차실행이 아니라 async하게 실행되는 듯 싶다.
Channel, Buffering, Non-Blocking
Channel
- go routine 에서 messages 라는 채널로 보내고
- main 함수에서 받는 모습
package main
import "fmt"
func main() {
messages := make(chan string)
go func() { messages <- "ping" } ()
msg := <-messages
fmt.Println(msg)
}
- 다음은 에러
fatal error: all goroutines are asleep - deadlock!
package main
import "fmt"
func main() {
messages := make(chan string)
messages <- "ping"
msg := <-messages
fmt.Println(msg)
}
Buffering
- Channel 에서 에러가 났던 부분을 Buffering 을 통해 수정가능
make(chan string, 1)
package main
import "fmt"
func main() {
messages := make(chan string, 1)
messages <- "ping"
msg := <-messages
fmt.Println(msg)
}
Non-Blocking
- select 에서 default: 부분
package main
import "fmt"
func main() {
messages := make(chan string)
select {
case msg := <-messages:
fmt.Println("received message", msg)
default:
fmt.Println("no activity")
}
}
How to mount host directory in docker container
docker 간단한 작업
docker container 에서 파일 꺼내기
$ sudo docker cp hello-nginx:/etc/nginx/nginx.conf ./
macOS 에서 원화대신 백쿼트 입력하기
shell expansion
https://www.gnu.org/software/bash/manual/html_node/Shell-Expansions.html#Shell-Expansions
- Brace Expansion: Expansion of expressions within braces.
- Tilde Expansion: Expansion of the ~ character.
- Shell Parameter Expansion: How Bash expands variables to their values.
- Command Substitution: Using the output of a command as an argument.
- Arithmetic Expansion: How to use arithmetic in shell expansions.
- Process Substitution: A way to write and read to and from a command.
- Word Splitting: How the results of expansion are split into separate arguments.
- Filename Expansion: A shorthand for specifying filenames matching patterns.
- Quote Removal: How and when quote characters are removed from words.
configure, make and make install ?
요약(tl;dr)
$ ./configure
$ make
$ sudo make install
compile Ambari Metrics Storm Sink error
https://community.hortonworks.com/questions/93448/compile-ambari-metrics-storm-sink-error.html
<properties>
<storm.version>1.1.0-SNAPSHOT</storm.version>
</properties>
1.1.0-SNAPSHOT
--> 1.1.0
으로 변경
이유는 잘 모르겠음..
sharding vs. replication
hadoop xattr(Extended attribute) 란?
- 파일이나 디렉터리에 metadata를 엮는 것. system-level의 metadata(예를 들면, 파일 권한, 수정된 시각 등)과는 달리 시스템이 알아들을 수 없다. 하지만 application에 의해서 inode에 대한 부가적인 정보를 저장할 수 있다.
https://hadoop.apache.org/docs/r2.7.2/hadoop-project-dist/hadoop-hdfs/ExtendedAttributes.html
dockerfile 에서 CMD 와 RUN 의 차이
RUN 은 image 를 만들어낼 때 사용되는 과정
CMD 는 container 를 실행시킬 때 수행되는 것
CMD 는 dockerfile 에서 하나만 존재한다.
python argparse
ArgumentParser.add_argument(name or flags...[, action][, nargs][, const][, default][, type][, choices][, required][, help][, metavar][, dest])
Define how a single command-line argument should be parsed. Each parameter has its own more detailed description below, but in short they are:
name or flags - Either a name or a list of option strings, e.g. foo or -f, --foo.
action - The basic type of action to be taken when this argument is encountered at the command line.
nargs - The number of command-line arguments that should be consumed.
const - A constant value required by some action and nargs selections.
default - The value produced if the argument is absent from the command line.
type - The type to which the command-line argument should be converted.
choices - A container of the allowable values for the argument.
required - Whether or not the command-line option may be omitted (optionals only).
help - A brief description of what the argument does.
metavar - A name for the argument in usage messages.
dest - The name of the attribute to be added to the object returned by parse_args().
git rebase 란?
docker container 간단히 모두 종료시키기
$ sudo docker rm $(docker ps -aq)
docker ps -aq
명령어를 실행시켰을 때, container id 가 세로로 표시되지만, 띄어쓰기나 다름없으므로 docker rm
명령어의 인자 전달에는 문제가 없다.
ruby 버전 업데이트
hadoop Quota란?
종류
- name quota: 최대 이름 수 제한(하둡은 큰 파일로 조금 있는 걸 좋아하지, 작은 파일로 여러 개 갖고 있는 걸 좋아하지 않는다. 그 이유는 네임노드가 얘네들에 대한 정보를 메모리에 들고 있는데, 작은파일이 지나치게 많다면 메모리 부족으로 죽어버릴 것이다.)
- space quota: 말 그대로 용량 제한
https://hadoop.apache.org/docs/r2.7.1/hadoop-project-dist/hadoop-hdfs/HdfsQuotaAdminGuide.html
"."(current directory)를 PATH 환경변수에 넣으면 안되는 이유
tl;dr(요약)
- PATH 환경변수 앞에 존재해서는 안된다.
- 흔히 쓰이는
ls
와 같은 이름의 악의적인 프로그램을 만들어 두고, superuser 가 그걸 실행시키도록 유도할 수 있음
- 흔히 쓰이는
- PATH 환경변수의 마지막에 위치해서도 안된다.
ls
,more
과 같은 명령어를 현재 디렉터리에 있는 걸 우선적으로 실행시키진 않겠지만,mroe
와 같은 프로그램을 파일시스템 전역에 뿌려놓았을 때, superuser 가 오타로mroe
를 입력하였을 때, 그 프로그램이 실행될 수 있다.
본문
(Practical UNIX and Internet Security, 3rd Edition 에서 발췌)
STEALING SUPERUSER
Once upon a time, many years ago, one of us needed access to the root account on an academic machine. Although we had been authorized by management to have root access, the local system manager didn’t want to disclose the password. He asserted that access to the root account was dangerous (correct), that he had far more knowledge of Unix than we did (unlikely), and that we didn’t need the access (incorrect). After several diplomatic and bureaucratic attempts to get access normally, we took a slightly different approach, with management’s wry approval.
We noticed that this user had “.” at the beginning of his shell search path. This meant that every time he typed a command name, the shell would first search the current directory for the command of the same name. When he did a su to root, this search path was inherited by the new shell. This was all we really needed.
First, we created an executable shell file named ls in the current directory:
#!/bin/sh
cp /bin/sh ./stuff/junk/.superdude
chmod 4555 ./stuff/junk/.superdude
rm -f $0
exec /bin/ls ${1+"$@"}
Then, we executed the following commands:
% cd
% chmod 700 .
% touch ./-f
The trap was ready. We approached the recalcitrant administrator with the complaint, “I have a funny file in my directory I can’t seem to delete.” Because the directory was mode 700, he couldn’t list the directory to see the contents. So, he used su to become user root. Then he changed the directory to our home directory and issued the command ls to view the problem file. Instead of the system version of ls, he ran our version. This created a hidden setuid root copy of the shell, deleted the bogus ls command, and ran the real ls command. The administrator never knew what happened.
We listened politely as he explained (superciliously) that files beginning with a dash character (-) needed to be deleted with a pathname relative to the current directory (in our case, rm ./-f); of course, we knew that.
A few minutes later, he couldn’t get the new root password.
참고
- Practical UNIX and Internet Security, 3rd Edition
- Chapter 5, STEALING SUPERUSER
- Chapter 16
- Chapter 23
파일이름 한번에 바꾸는 명령어
예) ts 확장자를 js 로 모두 바꾸는 명령어
for f in *.ts; do mv "$f" "${f%.ts}.js"; done
Shell-Parameter-Expansion
${parameter%word}
${parameter%%word}
The word is expanded to produce a pattern just as in filename expansion. If the pattern matches a trailing portion of the expanded value of parameter, then the result of the expansion is the value of parameter with the shortest matching pattern (the ‘%’ case) or the longest matching pattern (the ‘%%’ case) deleted. If parameter is ‘@’ or ‘’, the pattern removal operation is applied to each positional parameter in turn, and the expansion is the resultant list. If parameter is an array variable subscripted with ‘@’ or ‘’, the pattern removal operation is applied to each member of the array in turn, and the expansion is the resultant list.
- % 는 % 이하에 매칭되는 것을 삭제하는 명령. %와 %%의 차이는 shortest / longest matching 이다.
- 위의 예시에서
${f%.ts}.js
는 파일이름의 끝부분에 있는.ts
를 지우고 뒤에.js
를 붙이는 것이다.
npm install globally
https://nodejs.org/en/blog/npm/npm-1-0-global-vs-local-installation/
npm 으로 다른 패키지들을 설치할 때, /usr/local 하위로 설치하여 globally 사용하고 싶을 때, --prefix /usr/local 을 사용한다.
cf)
npm, node 를 /usr/local 에 위치시키고 싶다면, nodejs 공식홈페이지에서 소스를 다운받은 후에, 압축을 풀어 하위 디렉터리에 있는 /bin /include /share /lib 등의 디렉터리를 /usr/local 하위로 복사하자.
그리고 난 뒤에 npm install -g npm 를 해주면 최신버전의 npm 이 설치된다.
maven repository
maven 에서 local repository 를 명시할 수도 있다.
local repository, central repository 에서 pom.xml 에 나와있는 package 들을 찾는다.
central repository 는 어디에 명시되어 있을까?
http://mirror.navercorp.com/apache/maven/maven-3/3.5.0/source/apache-maven-3.5.0-src.tar.gz
위 소스를 다운받아, apache-maven-3.5.0/maven-model-builder/src/main/resources/org/apache/maven/model/pom-4.0.0.xml
파일을 열어보면, Central Repository
가 https://repo.maven.apache.org/maven2
로 명시되어있는 것을 볼 수 있다.
-
어떠한 POM 이든, parent POM 을 가리킬 수 있는데, 만일 parent POM 이 없다면, superpom 을 가리키게 된다. 위에서 언급한 pom-4.0.0.xml 파일이 바로 superpom 이다. 다음과 같이 주석에도 명시가 되어 있다.
-
pom-4.0.0.xml
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<!-- START SNIPPET: superpom -->
<project>
<modelVersion>4.0.0</modelVersion>
<repositories>
<repository>
<id>central</id>
<name>Central Repository</name>
<url>https://repo.maven.apache.org/maven2</url>
<layout>default</layout>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
...
POM hierarcy
- 출처: mastering apache maven 3
POM files maintain a parent-child relationship between them. A child POM file inherits all the configuration elements from its parent POM file. This is how Maven sticks to its design philosophy, which is convention over configuration.
"convention over configuration"
remove ugly url-encodings when copying urls
jps: jvm 으로 돌아가는 프로세스 확인
no contents
split string into array
https://stackoverflow.com/questions/10586153/split-string-into-an-array-in-bash
read -r -a array <<< $somestring
commit message 를 통한 issue 닫기
javascript의 for in은 python과 다르다.
javascript
for(var i in array) {
console.log(array[i]);
}
자바스크립트 코드에서 i 는 array 의 한 원소를 가리키는 게 아니라 인덱스를 나타낸다(!)
var obj = {
id: "myid",
name: "myname"
}
for(var attr in obj) {
console.log(attr);
}
배열이 아닌 객체의 요소들을 탐색하면 객체의 속성명이 들어가게 된다(!)
python
>>> someList = [1, 2, 3, 4]
>>> for item in someList:
... print item
...
1
2
3
4
파이썬 코드에서는 한 원소를 나타내게 된다.
python을 이용하여 손쉽게 json parsing 하기
Node.js에서 쉘스크립트 실행시키기
var exec = require('child_process').exec;
exec('node -v', function(error, stdout, stderr) {
console.log('stdout: ' + stdout);
console.log('stderr: ' + stderr);
if (error !== null) {
console.log('exec error: ' + error);
}
});
var exec = require('child_process').exec;
cf. 위 코드 부분을 app.listen() 함수 이후에 호출하면 정상적으로 동작하지 않는다. app.listen() 이후에 것을 구동하지 않는 듯 하다.
typescript 에서 jquery 사용하
python 에서 asterisk(star)의 의미는 무엇일까?
args, kwargs
- http://stackoverflow.com/questions/36901/what-does-double-star-and-star-do-for-parameters
- *args, **kwargs 라는 문구를 종종 보게 된다. args는 일반적인 argument들이 모여있는 형태, for-in 반복문으로 접근이 가능하다.
In [1]: def foo(*args):
...: for a in args:
...: print a
...:
...:
In [2]: foo(1)
1
In [4]: foo(1,2,3)
1
2
3
- kwargs는 keyword arguments로서 dictionary 처럼 접근이 가능하다.
In [5]: def bar(**kwargs):
...: for a in kwargs:
...: print a, kwargs[a]
...:
...:
In [6]: bar(name='one', age=27)
age 27
name one
Jekyll으로 만든 웹사이트에서 제공하는 파일은 어떻게 명시하는가?
- plain text를 작성하는 것만으로도 정적인 웹사이트를 손쉽게 만들 수 있게 해주는 것
알아볼 것
- YAML front matter(머리말)이 없는 경우에, Jekyll 디렉터리 내의 모든 파일을 있는 그대로 제공할 수 있다.
- _config.yml 파일에서 exclude 설정을 하면 제외시킬 수 있다.
- 예) _config.yml
...
exclude:
- Gemfile
- Gemfile.lock
...
- _site 디렉터리는
$ jekyll serve
명령을 실행시킬 때마다 새롭게 갱신된다. - 따라서, _site 디렉터리 내에 임의로 파일을 넣어주더라도
$ jekyll serve
명령을 실행시키면 없어질 수 있다. $ jekyll serve
명령으로 생성된 사이트는 기본값으로 _site 디렉터리에 저장된다. 그렇다면, 명령이 실행될 때마다 새롭게 생성되는 셈이니까 굳이 git과 같은 저장소에 보낼 필요는 없을 것이다. 보통 .gitignore에 _site 디렉터리 path를 추가하곤 한다. jekyll document 참조
_site
This is where the generated site will be placed (by default) once Jekyll is done transforming it. It’s probably a good idea to add this to your .gitignore file.
ubuntu bash prompt 초기화
color_prompt=yes
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
버튼 태그에 링크 걸기
이미지 크기에 맞게 줄이기
ls color option
root@hostname# vi ~/.bashrc
export LS_OPTIONS='--color=auto'
eval "`dircolors`"
alias ls='ls $LS_OPTIONS'
차세대, 고도화, 유지보수, 통합시스템 구축
오픈소스에 add class 후 빌드 에러 발생(Too many files with unapproved license)
출처: http://jjeong.tistory.com/1014
[ERROR] Failed to execute goal org.apache.rat:apache-rat-plugin:0.11:check (default) on project ambari-server: Too many files with unapproved license: 1 See RAT report in: /Users/hwjeong/git/ambari/ambari-server/target/rat.txt -> [Help 1]
이 에러는 뭐 오픈소스 사용하면서 class header 에 ASF 라이센스 정보를 작성 하지 않아서 발생하는 것입니다.
그러니 넣어 주시면 에러가 없어 집니다.
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Connecting IPv6 and IPv4 Networks
tl;dr
- dual stack
- tunneling
- translation
Promise 란?
[FHS] /usr/bin/env /usr/bin /usr/local/bin ...
binary directory 가 참 많다.
/bin/
/sbin/
/usr/bin/
/usr/sbin/
/usr/local/bin/
/usr/local/sbin/
~/bin/
경로를 직접 지정해 주면, dependency 가 생기기 마련이다. env 명령어를 사용하여, PATH 환경변수에 있는 디렉터리에서 찾게끔 할 수 있다. 이렇게 한다면 경로를 직접 명시해서 발생하는 의존성을 줄일 수 있다.
다음은 shebang(hashbang) 에서 python 을 명시하는 방법이다.
#!/usr/bin/env python
print "hello world!"
아래와 같이 하면 less flexible
#!/usr/bin/python
print "hello world!"
cf. env 명령어
https://en.wikipedia.org/wiki/Env
-i 옵션을 주면, 현재 설정되어 있는 모든 환경변수를 무시하고 다른 명령어를 실행할 수 있다.
다음은 환경변수를 clear 하고 새로운 쉘을 켜는 방법이다.
$ env -i /bin/sh
binary directory 정리
출처: https://unix.stackexchange.com/questions/8656/usr-bin-vs-usr-local-bin-on-linux
/bin/
/sbin/
/usr/bin/
/usr/sbin/
/usr/local/bin/
/usr/local/sbin/
~/bin/
/bin
(and/sbin
) were intended for programs that needed to be on a small/
partition before the larger /usr, etc. partitions were mounted. These days, it mostly serves as a standard location for key programs like/bin/sh
, although the original intent may still be relevant for e.g. installations on small embedded devices./sbin
, as distinct from/bin
, is for system management programs (not normally used by ordinary users) needed before /usr is mounted.- /usr/bin is for distribution-managed normal user programs.
- There is a
/usr/sbin
with the same relationship to/usr/bin
as/sbin
has to/bin
. /usr/local/bin
is for normal user programs not managed by the distribution package manager, e.g. locally compiled packages. You should not install them into/usr/bin
because future distribution upgrades may modify or delete them without warning./usr/local/sbin
, as you can probably guess at this point, is to/usr/local/bin
as/usr/sbin
to/usr/bin
.
locally compile 한다면, /usr/local/bin
혹은 /usr/local/sbin
에 위치시키는 것이 옳다.
/bin
, /sbin
==> /usr/bin
, /usr/sbin
?
FHS(Filesystem Hierarchy Standard)
html global attributes
file permission
http://www.tutonics.com/2012/12/linux-file-permissions-chmod-umask.html
- sticky bit
- setuid
- setgid
Anti-pattern 이란?
실행결과를 변수화
출처: http://pyrasis.com/book/DockerForTheReallyImpatient/Chapter04
$()
``
예제
$ echo $(date)
$ echo `date`
HTTP 를 실험해볼 수 있는 사이트 http://httpbin.org/
[dockerfile] RUN export
http://stackoverflow.com/questions/33379393/docker-env-vs-run-export
export 명령은 image 를 통틀어서 먹히질 않는다.
ENV
를 dockerfile 에서 사용하자
REST API
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.