Skip to content

Instantly share code, notes, and snippets.

@devops-school
devops-school / docker-volume-size-limit.txt
Created May 21, 2020 11:13
How to specify the size limit while creating the docker volume?
# docker -v
Docker version 19.03.9, build 9d988398e7
# docker volume create -h
Flag shorthand -h has been deprecated, please use --help
Usage: docker volume create [OPTIONS] [VOLUME]
Create a volume
@strarsis
strarsis / 50-cloud-init.yml
Last active February 13, 2023 19:30
Hetzner Cloud netplan configuration for IPv4+IPv6 (Dual Stack)
# /etc/netplan/50-cloud-init.yml
# Ensure that other netplan config yml files in /etc/netplan/ don't interfere with this configuration
network:
version: 2
renderer: networkd
ethernets:
ens3: # (Primary interface, usually ens3 or ens33 on recent Ubuntus)
addresses:
- <Hetzner instance IP4>/32
@Asikur22
Asikur22 / functions.php
Last active November 17, 2022 11:37
Disable WP CF7 Refill #ContactForm7
/*
* Disable CF7 Refill
*/
function aa_disable_wpcf7_refill() {
global $wp_scripts;
$handle = 'contact-form-7';
$object_name = 'wpcf7';
$data = $wp_scripts->get_data( $handle, 'data' );
if ( ! empty( $data ) ) {
if ( ! is_array( $data ) ) {

Interview Questions

Node.js

Q1: What do you mean by Asynchronous API? ☆☆

Answer: All APIs of Node.js library are aynchronous that is non-blocking. It essentially means a Node.js based server never waits for a API to return data. Server moves to next API after calling it and a notification mechanism of Events of Node.js helps server to get response from the previous API call.

Source: tutorialspoint.com

@Conplug
Conplug / Conplug_DHT11_Light.ino
Last active May 16, 2022 18:34
NTP Clock, Temperature, Humidity and Light Level.
//
// Copyright (c) 2019 Conplug (https://conplug.com.tw)
// Author: Hartman Hsieh
//
// Description :
// - 同步 NTP 時間
// - 顯示溫度值 (C)
// - 顯示溼度值 (%)
// - 顯示光照強度 (LUX)
// - 若尚未設定 WIFI SSID 會直接進入 SmartConfig 模式,可由手機 APP 配置 WIFI SSID 與密碼。
@Unbinilium
Unbinilium / Config-shadowsocks-libev-on-Linux.md
Last active October 7, 2024 00:24
Config shadowsocks-libev on Linux

With no time updating Twist, I wrote this extremly simple script to setup shadowsocks-libev both server and client.

apt-get update -y
apt-get upgrade -y
apt-get dist-upgrade -y
apt-get autoremove -y
apt-get install --no-install-recommends -y gettext build-essential autoconf libtool libpcre3-dev asciidoc xmlto libev-dev libc-ares-dev automake golang golang-go fail2ban apache2 unzip git
git clone https://github.com/jedisct1/libsodium --branch master
pushd libsodium
bash autogen.sh
@merlox
merlox / Upload.txt
Created October 23, 2019 12:22
The file upload summary
// Index.html
<div>
<h1>File upload</h1>
<input type="file" multiple onChange={e => uploadFile(e)}/>
</div>
// Index.js
const uploadFile = async e => {
const files = e.target.files
@bradtraversy
bradtraversy / node_nginx_ssl.md
Last active August 13, 2025 14:06
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user

@senthilmpro
senthilmpro / download-file-axios-nodejs.js
Last active August 2, 2024 13:33
Download File using axios : Node.js program
'use strict'
const Fs = require('fs')
const Path = require('path')
const Axios = require('axios')
async function downloadImage () {
const url = 'https://unsplash.com/photos/AaEQmoufHLk/download?force=true'
const path = Path.resolve(__dirname, 'images', 'code1.jpg')
@mrbar42
mrbar42 / README.md
Last active July 25, 2025 18:19
Secured HLS setup with Nginx as media server

Secured HLS setup with Nginx as media server

This example is part of this article.

This is an example for an HLS delivery with basic security. Nginx compiled with nginx-rtmp-module & secure-link is used as media server. Features:

  • Domain filtering
  • Referrer filtering
  • Embed buster