This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.collection.JavaConverters._ | |
object Solution { | |
def solution(a: Array[Int]): Int = { | |
var sum = 0 | |
for (i <- 0 to (a.length - 1)) { | |
sum += a(i) | |
} | |
var sum_left = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git diff --no-prefix master > diff.patch | |
git checkout master patch -p0 < diff.patch |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rpm2cpio filename.rpm | cpio -idmv |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo yum install rpm-build | |
mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS,TMP} | |
touch ~/.rpmmacros | |
~~~ | |
%packager ffimusic | |
%_topdir /home/ffimusic/rpmbuild | |
%_tmppath /home/ffimusic/rpmbuild/TMP | |
~~~ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
It is possible to go back to a more classic iptables setup. First, stop and mask the firewalld service: | |
systemctl stop firewalld | |
systemctl mask firewalld | |
Then, install the iptables-services package: | |
yum install iptables-services | |
Enable the service at boot-time: | |
systemctl enable iptables |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# working with args | |
:args - list | |
:n - next | |
:prev - previous | |
:n [filename] - open new file | |
# working with tabs | |
:tabe [filename] - open new tab | |
:tabn - next | |
:tabp - previous |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Saving Sessions | |
:mksession ~/cs.vim | |
# Loading Sessions | |
:source ~/cs.vim |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# set autoread so there are no interactive Load File option | |
:set ar | |
# save the command using tee and discard tee echo | |
:w !sudo tee % > /dev/null |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FILENAME: References the current input file. | |
FNR: References the number of the current record relative to the current input file. For instance, if you have two input files, this would tell you the record number of each file instead of as a total. | |
FS: The current field separator used to denote each field in a record. By default, this is set to whitespace. | |
NF: The number of fields in the current record. | |
NR: The number of the current record. | |
OFS: The field separator for the outputted data. By default, this is set to whitespace. | |
ORS: The record separator for the outputted data. By default, this is a newline character. | |
RS: The record separator used to distinguish separate records in the input file. By default, this is a newline character. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# build docker config | |
docker build -t [name:tag] . | |
# inspecting containers | |
docker inspect [container-id] | |
# create an image from a container | |
docker commit -a [author] -m [message] [container-id] [name:tag] | |
# compare docker container with image |