This file contains 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
@Configuration | |
@EnableJpaRepositories(value = "ru.mrchebik.repository", entityManagerFactoryRef = "entityManagerFactoryBean", transactionManagerRef = "transactionManager") | |
@EnableTransactionManagement | |
public class PersistenceJPAConfig { | |
@Bean | |
public LocalContainerEntityManagerFactoryBean entityManagerFactoryBean() { | |
Properties properties = new Properties(); | |
properties.put("hibernate.hbm2ddl.auto", "update"); | |
properties.put("hibernate.dialect", "org.hibernate.dialect.MySQLDialect"); | |
properties.put("hibernate.connection.charSet", "UTF-8"); |
This file contains 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
#!/bin/bash | |
MUSER="$1" | |
MPASS="$2" | |
MDB="$3" | |
# Detect paths | |
MYSQL=$(which mysql) | |
AWK=$(which awk) | |
GREP=$(which grep) | |
This file contains 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
RECOMMEND TO SAVE ALSO ALL NATIVE FILES FROM DATABASE | |
-- backup | |
mysqldump -u USER -pPASSWORD DATABASE > /path/to/file/dump.sql | |
-- structure database | |
mysqldump --no-data - u USER -pPASSWORD DATABASE > /path/to/file/schema.sql | |
-- dump of one or else tables | |
mysqldump -u USER -pPASSWORD DATABASE TABLE1 TABLE2 TABLE3 > /path/to/file/dump_table.sql | |
-- backup and archive | |
mysqldump -u USER -pPASSWORD DATABASE | gzip > /path/to/outputfile.sql.gz |
This file contains 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
scp -r root@192.168.0.2:/home2/ /home/ | |
scp root@192.168.0.1:/home/file1.zip root@192.168.0.2:/home2/ | |
-r -- recursive | |
-P port -- non-standart port (22) |
This file contains 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
--Install | |
CentOS6: | |
$ yum install wget | |
$ wget dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm | |
$ rpm -ivh epel-release-6-8.noarch.rpm | |
$ yum install optipng | |
Mageia: | |
through install manager |
This file contains 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
--Install | |
CentOS6: | |
$ yum install wget autoconf automake gcc nasm git | |
$ wget https://github.com/mozilla/mozjpeg/releases/download/v3.1/mozjpeg-3.2-release-source.tar.gz | |
$ tar xvfz mozjpeg-3.2-release-source.tar.gz | |
$ cd mozjpeg | |
$ ./configure | |
$ make | |
$ make install |
This file contains 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
--Install | |
Mageia: | |
Download libpng(16) (sourceforge, read INSTALL) | |
$ git clone --recursive https://github.com/pornel/pngquant.git | |
$ make | |
$ make install | |
--In action | |
$ pngquant --speed 1 /path/to/image.png |
This file contains 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
sh /path/to/script.sh > log.txt 2>&1 & |
This file contains 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
public class Main { | |
private static final int NUMBER_OF_CORES = Runtime.getRuntime().availableProcessors(); | |
public static void main(String[] args) { | |
Stream.of("WELL, PRINCE, so Genoa and Lucca are now " + | |
"just family estates of the Buonapartes. But I " + | |
"warn you, if you don't tell me that this means " + | |
"war, if you still try to defend the infamies and " + | |
"horrors perpetrated by that Antichrist I real- " + | |
"ly believe he is Antichrist I will have nothing " + |
This file contains 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
public static void main(String[] args) { | |
final int[] pinger = {0}; | |
System.out.println("WELL, PRINCE, so Genoa and Lucca are now just family estates of the Buonapartes. But I warn you, if you don't tell me that this means war, if you still try to defend the infamies and horrors perpetrated by that Antichrist I really believe he is Antichrist I will have nothing more to do with you and you are no longer my friend, no longer my 'faithful slave', as you call yourself! But how do you do? I see I have frightened you sit down and tell me all the news." | |
.trim().chars().mapToObj(i -> (char) i).collect(Collector.of( | |
(Supplier<List<String>>) ArrayList::new, | |
(array, ch) -> { | |
if (array.size() == 0) { | |
array.add(""); | |
} |
OlderNewer