Skip to content

Instantly share code, notes, and snippets.

View Inkimar's full-sized avatar

Ing Erl Inkimar

  • Stockholm
  • 00:38 (UTC -12:00)
View GitHub Profile
@Inkimar
Inkimar / backup
Created January 4, 2017 10:47
nub-project, mskytter+gbif - backup and restore
backup-db:
docker exec -it db \
bash -c "pg_dump -U $(POSTGRES_USER) -d $(POSTGRES_DB) > /tmp/clb.sql"
restore-dyntaxa-dump:
test -f clb.sql || curl -L --progress -o clb.sql \
"https://nrmowncloud.nrm.se/owncloud/index.php/s/0tiY0uLW4wqQ9p7/download?path=%2F&files=clb_structure_and_data.dump"
docker cp clb.sql db:/tmp/clb.sql
@Inkimar
Inkimar / gist:040c0e3be05f675acb00f9ebe6810761
Created March 15, 2017 13:20
troubleshooting docker when using DNS .....
If you have set up your system, so that you can run dns-docker and run into trouble.
Trouble:
$ sudo service docker restart
Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.
Files you should look into:
(1) /etc/default/docker
The 2 lines starting with 'DOCKER_OPTS' should be commented-out
# Use DOCKER_OPTS to modify the daemon startup options.
@Inkimar
Inkimar / gist:5d10083c12052c17afbf56553ec43b96
Created September 14, 2016 13:08
building a publishing a relese with travis-ci
Github and Travis
#prereq for travis installation:
1. install travis-cli
1.1 ruby --version
-> gives 2.3
(1.2 sudo apt-get install pkg-config)
1.2 sudo apt-get install build-essential
sudo apt-get install libffi-dev
#install travis
@Inkimar
Inkimar / create user with privs
Created June 29, 2017 09:55
create a user in mysql with privs to 1 db
CREATE USER 'ink'@'localhost' IDENTIFIED BY 'ink';
GRANT ALL PRIVILEGES ON inksdb.* To 'ink'@'localhost' IDENTIFIED BY 'ink';
@Inkimar
Inkimar / mysql help commands
Last active June 29, 2017 12:15
mysql help commands
2017-06-29
mysql> select version();
+-------------------------+
| version() |
+-------------------------+
| 5.7.18-0ubuntu0.16.04.1 |
+-------------------------+
1 row in set (0,00 sec)
push a branch:
git push -u origin <branch> , i.e git push -u origin issue8
fetch only a branch:
git clone -b <branch> <repo>.git
https://github.com/mskyttner/specify-docker/blob/master/s6init.sql
example with multipled privileges:
create user if not exists 'xx'@'%' identified by 'xx';
create user if not exists 'yy'@'%' identified by 'yy';
grant select, insert, update, delete, lock tables,
alter, create, drop,
index, grant option on specify6.*
@Inkimar
Inkimar / gist:446cb54f0c61a1fc1d50ed03cf03f3ab
Created September 4, 2017 12:03
bash script fetching data from a csv-file
file : users.csv ( put that file in .gitignore)
users.csv
user,password
gpg -c users.csv generates users.csv.gpg -> push to github
run script
#!/bin/bash
while IFS=, read user password
do
@Inkimar
Inkimar / gist:41ad312094ec37078172ad7d732dd9a2
Created September 5, 2017 14:17
20170905, se närmare på lösningen med lösenord
https://github.com/mskyttner/ala-docker/blob/master/Makefile
@Inkimar
Inkimar / gist:2a8faf02dc8223e81a3c7d401741c976
Created August 24, 2017 14:45
backing up files from docker using an .env-file
Q1: use gpg in the script, fetch psw from file does not work ...
Q2: use scp to cp the file to a remote location
info: mysqldump + tarring all the redmine_files ... becomes an tar.
#!/bin/bash
source .env/.env.db
TARGET=tst
NOW=`date +"%Y-%m-%d"`
TARGET_DIR=$TARGET/$NOW