Skip to content

Instantly share code, notes, and snippets.

View MrChebik's full-sized avatar

Oleksandr Beschasnyi MrChebik

View GitHub Profile
@MrChebik
MrChebik / optipng
Last active September 24, 2017 17:11
--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
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)
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
#!/bin/bash
MUSER="$1"
MPASS="$2"
MDB="$3"
# Detect paths
MYSQL=$(which mysql)
AWK=$(which awk)
GREP=$(which grep)
@MrChebik
MrChebik / gist:69b1bf4b47bf5e2560bbef2eb6c2bee3
Created March 12, 2017 12:06
jpa configuration through Java
@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");