Skip to content

Instantly share code, notes, and snippets.

View Inkimar's full-sized avatar

Ing Erl Inkimar

  • Stockholm
  • 20:03 (UTC -12:00)
View GitHub Profile
@Inkimar
Inkimar / gist:72b8664abd3086bdf48d270c148f1c2d
Last active October 28, 2016 12:04
erase all docker images and containers
#!/bin/bash
# Delete all containers
docker rm -f $(docker ps -a -q)
# Delete all images
docker rmi -f $(docker images -q)
remove one image:
docker rmi dina/media:v0.4
check
@Inkimar
Inkimar / gist:586b25b082d62a10181b5ceb6271dce9
Last active October 28, 2016 13:24
Fetch docker image and inspect the image
ex.
docker pull dina/media:v0.4
docker run --rm -it dina/media:v0.4 bash
docker run -it -p 9990:9990 dina/media:v0.4
remove one image:
docker rmi dina/media:v0.4
remove a single container ( whith id = beec50b40e9cf67cddd7cf38557f60510d22d2d90182932dfd56974da5075b27 )
driver=com.mysql.jdbc.Driver
url=jdbc:mysql://localhost:3306/liquibase_demo
username=demo
password=demo
verbose=true
dropFirst=false
@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:cdab78832e0eb1210adf66a7f77e1afe
Last active June 23, 2021 13:30
cron / crontab - echo to crontab, when no editore is available
example from redmine:
crontab -l | { cat; echo "*/5 * * * * /usr/src/redmine/receive_imap.sh"; } | crontab -
@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
@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