Skip to content

Instantly share code, notes, and snippets.

@Strong
Strong / mysql-docker.sh
Created May 30, 2024 22:10 — forked from nshtg/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
@Strong
Strong / mysql-docker.sh
Created May 30, 2024 21:08 — 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 --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@Strong
Strong / osxtweaks
Created July 9, 2023 22:58 — forked from vividvilla/osxtweaks
Brian's List of OSX Tweaks for web developers
#OSX Tweaks:
===========
- Most need reboot to show changes
- Most of these tweaks are just for speed, but some are specific for development
- All of these are to be ran in terminal. The commands to be copy and pasted start after the less-than sign.
- I'm not responsible for any adverse effects to your computer, at all.
##Increase the speed of OS X dialogs boxes:
@Strong
Strong / 00_README.md
Created June 17, 2023 16:04 — forked from LeZuse/00_README.md
Install node on Apple Silicon M1 both ARM and x86 (Rosetta)

Node.js on Apple Silicon

Node Version Manager (https://github.com/nvm-sh/nvm) works perfectly across native node installations as well as emulated Rosetta installations. The trick I am using here is to install one LTS version of node under Rosetta and another stable version as native binary.

TODO

  • find a way how to run the same node version on both platforms
@Strong
Strong / bitrix-menu-override.sh
Created May 1, 2023 20:27 — forked from disafronov/bitrix-menu-override.sh
Disable bitrix menu autostart and set banner
# /etc/profile.d/00-bitrix-menu-override.sh
if [[ $- == *i* ]] && [[ ${UID} -eq 0 ]]; then
# Disable bitrix menu autostart
mv ~/menu.sh ~/.menu.sh 2> /dev/null
sed -i -e 's/^~\/menu.sh/\#~\/menu.sh/g' ~/.bash_profile
# Manual menu banner
echo "BitrixVM Customized: for bitrix menu run [~/.menu.sh]"
fi
@Strong
Strong / auth.js
Created September 20, 2022 12:22 — forked from zolotyx/auth.js
Nuxt Auth Redirect Fix
export const isSameURL = (a, b) => a.split('?')[0] === b.split('?')[0]
export const isRelativeURL = u =>
u && u.length && /^\/[a-zA-Z0-9@\-%_~][/a-zA-Z0-9@\-%_~]*[?]?([^#]*)#?([^#]*)$/.test(u)
export default function ({ app }) {
const redirect = function (name, noRouter = false) {
if (!this.options.redirect) {
return
}
@Strong
Strong / auth.js
Created September 20, 2022 12:22 — forked from motia/auth.js
Nuxt Auth Redirect Fix
export const isSameURL = (a, b) => a.split('?')[0] === b.split('?')[0]
export const isRelativeURL = u =>
u && u.length && /^\/[a-zA-Z0-9@\-%_~][/a-zA-Z0-9@\-%_~]*[?]?([^#]*)#?([^#]*)$/.test(u)
export default function ({ app }) {
const redirect = function (name, noRouter = false) {
if (!this.options.redirect) {
return
}
@Strong
Strong / hooks-index.js
Created June 28, 2022 23:38 — forked from renoirb/hooks-index.js
Nuxt 'render:setupMiddleware' hook example
// file: hooks/index.js
import render from './render'
// 'render:context'
export default (nuxtConfig) => ({
render: render(nuxtConfig),
})
@Strong
Strong / axios.js
Created June 7, 2022 01:03 — forked from sidigi/axios.js
Nuxt Refresh token request
export default function ({$axios, app}) {
$axios.onResponseError(error => {
const code = parseInt(error.response && error.response.status);
let originalRequest = error.config;
if ([401, 403].includes(code)) {
originalRequest.__isRetryRequest = true;
let refresh_token = app.$auth.getRefreshToken(app.$auth.$storage.state.strategy).replace('Bearer ', '');
yup.addMethod(yup.string, 'domain', function pattern(name, message = VALIDATION_ERRORS.domain) {
const domainRules = [patterns.domain, patterns.punycode, patterns.cyrillicDomain];
return this.test({
message,
test: value => (value === null || value === '' || value === undefined) || domainRules.some(regex => regex.test(value)),
});
});