Skip to content

Instantly share code, notes, and snippets.

@maxivak
maxivak / _0__ssl_certbot_letsencrypt.md
Last active April 16, 2024 21:48
Let's encrypt SSL certificates using certbot in docker

Directories on host machine:

  • /data/certbot/letsencrypt

  • /data/certbot/www

  • Nginx server in docker container

docker run -d --name nginx \
@nickjj
nickjj / 01-image-slugs.sh
Last active July 11, 2023 19:04
List of DigitalOcean slugs for images, sizes and regions.
# Listed generated on 2021-08-07 at 3:45am EST
curl -s -X GET -H "Content-Type: application/json" \
-H "Authorization: Bearer ${DIGITALOCEAN_ACCESS_TOKEN}" \
"https://api.digitalocean.com/v2/images?page=1&per_page=100&type=distribution" \
| jq '.images[].slug' | sort
"centos-7-x64"
"centos-8-x64"
"centos-stream-8-x64"
"debian-10-x64"
FROM golang:alpine3.11 AS builder
RUN apk update && apk add --no-cache git
ENV USER=appuser
ENV UID=10001
RUN adduser \
--disabled-password \
--gecos "" \
@pirosuke
pirosuke / fetch_remote_db_data.js
Created January 19, 2019 17:51
Sample To Fetch Data From Remote Database Table Through SSH Tunnel With Node.js
const tunnel = require('tunnel-ssh');
import knexLib = require('knex');
async function main() {
const sshUserName = 'SSH_USER_NAME';
const sshPassword = 'SSH_PASSWORD';
let sshConfig = {
host: 'SSH_HOST_ADDRESS',
port: SSH_PORT,
@jofftiquez
jofftiquez / mock-http.js
Last active February 27, 2024 02:23
Mock HTTP request in javascript using promise and timeout.
const mock = (success, timeout = 1000) => {
return new Promise((resolve, reject) => {
setTimeout(() => {
if(success) {
resolve();
} else {
reject({message: 'Error'});
}
}, timeout);
});
//https://habr.com/post/213515/
// This works on all devices/browsers, and uses IndexedDBShim as a final fallback
var indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB || window.shimIndexedDB,
IDBTransaction = window.IDBTransaction || window.webkitIDBTransaction || window.msIDBTransaction,
baseName = "baseName",
storeName = "storeName";
function logerr(err){
console.log(err);
@MustafaMagdi
MustafaMagdi / Container.php
Last active April 17, 2024 19:14 — forked from tlikai/container.php
PHP Dependency Injection Container
<?php
/**
* Class Container
*/
class Container
{
/**
* @var array
*/
@chrishorton
chrishorton / hangmanwordbank.py
Created May 21, 2017 17:16
Hangman ascii art and wordbank
HANGMANPICS = ['''
+---+
| |
|
|
|
|
=========''', '''
+---+
@iissnan
iissnan / tail.ps1
Last active December 13, 2020 11:39
Unix tail equivalent command in Windows Powershell
Get-Content ./log.log -Wait -Tail 10
@BretFisher
BretFisher / README.md
Last active May 1, 2023 02:28
Simple Apache + Nginx Reverse Proxy Example in Docker Compose
  1. download these two files to the same directory
  2. docker-compose up
  3. http://localhost should show you "it works" which is apache being reverse-proxied through nginx
  4. docker sets up DNS for web based on compose service name so the nginx front-end can find http://web
  5. proxy is set to listen on public port 80 on host so it'll receive incoming traffic, then push to httpd