Skip to content

Instantly share code, notes, and snippets.

@nshtg
nshtg / mysql-docker.sh
Last active June 7, 2024 07:39 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root -pPASSWORD DATABASE > backup.sql
docker exec CONTAINER /usr/bin/mysqldump -u root -pPASSWORD DATABASE | gzip > backup.sql.gz
docker exec CONTAINER /usr/bin/mysqldump -u root -pPASSWORD DATABASE | bzip2 > backup.sql.bz2
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root -pPASSWORD DATABASE
gunzip < backup.sql.gz | docker exec -i CONTAINER /usr/bin/mysql -u root -pPASSWORD DATABASE
bunzip2 < backup.sql.bz2 | docker exec -i CONTAINER /usr/bin/mysql -u root -pPASSWORD DATABASE
@Geoyi
Geoyi / install virtualenv ubuntu 16.04.md
Created September 16, 2017 12:19 — forked from frfahim/install virtualenv ubuntu 16.04.md
How to install virtual environment on ubuntu 16.04

How to install virtualenv:

Install pip first

sudo apt-get install python3-pip

Then install virtualenv using pip3

sudo pip3 install virtualenv 
@dragolabs
dragolabs / proxmox-cli-and-tips.md
Last active January 4, 2024 10:21
Useful proxmox commands

Find next free VM ID

pvesh get /cluster/nextid

Create containter with external and internal nets

pct create 100 \
    local:vztmpl/ubuntu-16.04-standard_16.04-1_amd64.tar.gz \
    --cores 2 --cpuunits 1024 \
@thanuja919
thanuja919 / split-mysql-dump.sh
Created June 18, 2017 13:58
split-mysql-dump
#!/usr/bin/env bash
#When executing the script keep the main db dump in another folder.
AWK=awk
REGEX_NAME="Current Database: \`(.*)\`"
# Checks argument and prints usage if needed
if [ "$#" -lt "1" ]
then
@efeldhusen
efeldhusen / vmware-template.centos7.sh
Last active May 23, 2023 04:02
Bash script for Centos 7.x VMware Template Images
#!/bin/bash
#Paths are for Centos 7.x
# Install optional packages
/usr/bin/yum install -y epel-release
/usr/bin/yum install -y bash-completion htop yum-utils dkms open-vm-tools
#stop logging services
/sbin/service rsyslog stop
/sbin/service auditd stop
@fredrik-lundin
fredrik-lundin / web.config
Created March 28, 2017 16:51
web.config rewrite all requests to index.html
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="redirect all requests" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" pattern="" ignoreCase="false" />
</conditions>
<action type="Rewrite" url="index.html" appendQueryString="true" />
@danielscholl
danielscholl / ieESC_disable
Created March 20, 2017 14:19
Disable IE Enhance Security PowerShell
function Disable-ieESC {
$AdminKey = "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A7-37EF-4b3f-8CFC-4F3A74704073}"
$UserKey = "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A8-37EF-4b3f-8CFC-4F3A74704073}"
Set-ItemProperty -Path $AdminKey -Name "IsInstalled" -Value 0
Set-ItemProperty -Path $UserKey -Name "IsInstalled" -Value 0
Stop-Process -Name Explorer
Write-Host "IE Enhanced Security Configuration (ESC) has been disabled." -ForegroundColor Green
}
Disable-ieESC
@juemura
juemura / c9-github-integration.md
Last active September 12, 2023 09:40
Tutorial: How to connect your Cloud9 and GitHub accounts via ssh

#Tutorial: How to connect your Cloud9 and GitHub accounts via ssh

To avoid having to enter your username and password EVERY-SINGLE-TIME you push, follow these step-by-step instructions.


#####1. Copy your C9 ssh key. Go to https://c9.io/account/ssh and copy the key below *"Connect to your private git repository"*. It's a very long string that starts with ssh-rsa and ends with your email.

#####2. Paste your C9 ssh key into your GitHub account

@dragonken
dragonken / .vimrc
Last active April 11, 2024 13:27
YAML space indent for vim
syntax on
filetype plugin indent on
"Get the 2-space YAML as the default when hit carriage return after the colon
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
set is hlsearch ai ic scs
nnoremap <esc><esc> :nohls<cr>
"https://vim.fandom.com/wiki/Moving_lines_up_or_down
@JakeDEvans
JakeDEvans / kickstart_disk.cfg
Last active August 13, 2021 14:18
Kickstart config for full disk LVM (no partitions)
# Expects 2 vm disks
# Disk 1 = 1GB
# Disk 2 = DATA (5GB or larger)
# Disk Layout
clearpart --all --initlabel --drives=sda
part biosboot --fstype=biosboot --size=1 --ondisk=sda
part /boot --fstype=xfs --size=512 --grow --ondisk=sda
logvol swap --fstype=swap --name=swap --vgname=vg01 --size=512
logvol /tmp --fstype xfs --name=tmp --vgname=vg01 --size=1024
logvol / --fstype xfs --name=root --vgname=vg01 --size=2048 --grow