Skip to content

Instantly share code, notes, and snippets.

@ncochard
ncochard / babel-webpack.md
Last active April 2, 2025 18:22
The correct way to compile ES6 using babel...

When you create a npm package, remember it might be used in a browser or a server, or even a command line utility… For each package you create, please pay attention at what it will be used for:

  1. Is it going to be used as a dependency to a nodejs application that is not bundled? (e.g. command line utilities)
  2. Is it going to be used as a dependency to a nodejs application that is bundled? (e.g. AWS Lambdas)
  3. Is it going to be used as a dependency to a browser application (always bundled)?.
  • In cases 2) and 3) you want to allow for tree shaking.
  • In cases 1) and 2) you want to benefit from the "ES6"/"ES next" features supported natively by nodejs.
  • In case 3) you also want to benefit from the native support of "ES6" from your browser.
@hjbotha
hjbotha / free_ports.sh
Last active May 20, 2025 14:10
Free ports 80 and 443 on Synology NAS
#! /bin/bash
# NEWLY ADDED BACKUP FUNCTIONALITY IS NOT FULLY TESTED YET, USE WITH CARE, ESPECIALLY DELETION
# Developed for DSM 6 - 7.0.1. Not tested on other versions.
# Steps to install
# Save this script in one of your shares
# Edit it according to your requirements
# Backup /usr/syno/share/nginx/ as follows:
# # cd /usr/syno/share/
# # tar cvf ~/nginx.tar nginx
@tgfarias
tgfarias / main
Last active October 25, 2024 13:59
Docker commands
#Start docker
docker-compose up -d --build --force-recreate
#Import database
docker exec -i [container] mysql -u[user] -p[pass] [database] -v < [path_of_sql_import]
# 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
@ragul28
ragul28 / Docker-Export.md
Created January 11, 2020 09:02
Docker Container & image export/import

Export running or paused Container:

  • Export
docker export <dockernameortag> | gzip > mycontainer.tgz
  • Load
gunzip -c mycontainer.tgz | docker load
@marufshidiq
marufshidiq / HOWTO.md
Created April 12, 2020 07:03
Backup and Restore mongodb inside docker-compose container

How to backup

docker-compose exec -T <mongodb_service_name> mongodump --archive --gzip --db <mongodb_database> > dump.gz

How to restore

docker-compose exec -T  mongorestore --archive --gzip &lt; dump.gz
@s3rj1k
s3rj1k / HowTo
Last active May 4, 2025 21:37
Ubuntu 20.04.3 AutoInstall
# For recent versions of Ubuntu:
- https://www.pugetsystems.com/labs/hpc/ubuntu-22-04-server-autoinstall-iso/
# Docs:
- https://wiki.ubuntu.com/FoundationsTeam/AutomatedServerInstalls
- https://wiki.ubuntu.com/FoundationsTeam/AutomatedServerInstalls/ConfigReference
- https://cloudinit.readthedocs.io/en/latest/topics/datasources/nocloud.html
- https://discourse.ubuntu.com/t/please-test-autoinstalls-for-20-04/15250/53
# Download ISO Installer:
@linuxmalaysia
linuxmalaysia / sysctl-conf.txt
Created June 7, 2020 02:33
sysctl.conf for elasticsearch node
vm.max_map_count=262144
net.core.default_qdisc = fq
net.ipv4.tcp_congestion_control = bbr
net.ipv4.tcp_notsent_lowat = 16384
net.core.somaxconn = 4096
# Increase size of file handles and inode cache
fs.file-max = 20971520
# Do less swapping
@hellt
hellt / R1_nokia.cfg
Created June 17, 2020 10:04
R1 Nokia baseline config
# TiMOS-B-14.0.R4 both/i386 Nokia 7750 SR Copyright (c) 2000-2016 Nokia.
# All rights reserved. All use subject to applicable license agreements.
# Built on Thu Jul 28 17:26:53 PDT 2016 by builder in /rel14.0/b1/R4/panos/main
# Generated SUN MAR 13 06:28:52 2016 UTC
exit all
configure
#--------------------------------------------------
echo "System Configuration"
@Zhendryk
Zhendryk / The Ultimate Windows Development Environment.md
Last active February 21, 2025 02:16
How to set up the ultimate Windows development environment
@ekanant
ekanant / docker_compose_mysql_backup.sh
Last active October 25, 2024 13:59
Backup and restore MySQL in docker-compose
#reference https://medium.com/@siriphonnot/backup-and-restore-a-mysql-database-from-a-running-docker-mysql-container-6c932907e21f
#reference https://medium.com/@vineetcic/script-to-take-mysql-database-backup-for-last-7-days-45f97ed067a9
mysqlUser="root"
mysqlPassword="xxxxx"
mysqlHost="127.0.0.1"
DB="my_db"
credentialsFile="/mysql-credentials.cnf"
/usr/local/bin/docker-compose exec -T mysql bash -c "