Skip to content

Instantly share code, notes, and snippets.

@dahlsailrunner
dahlsailrunner / SSL-nginx-Docker.md
Last active September 12, 2024 00:59
SSL with Docker images using nginx as reverse proxy

Docker with SSL and an nginx reverse proxy

Running your ASP.NET Core (or other) application in Docker using SSL should not be an overwhelming task. These steps should do the trick.

Run the following steps from a Linux terminal (I used WSL or WSL2 on Windows from the Windows Terminal).

1. Create a conf file with information about the cert you'll be creating

It should look something like the content below; call it my-site.conf or something like that.

@bradennapier
bradennapier / validateCognito.js
Last active August 27, 2019 08:43
Just a rough sketch for validating cognito tokens
/* @flow */
import axios from 'axios';
import jose from 'node-jose';
import day from 'dayjs';
const AWS_REGION = '<AWS_REGION>';
const AWS_POOL_ID = '<POOL_ID>';
const AWS_APP_CLIENT_ID = '<APP_CLIENT_ID>';
const AWS_TOKEN_PUBLIC_KEYS_URL =
`https://cognito-idp.${AWS_REGION}.amazonaws.com/${AWS_POOL_ID}/.well-known/jwks.json`;
@KRostyslav
KRostyslav / tsconfig.json
Last active September 8, 2024 20:40
tsconfig.json с комментариями.
// Файл "tsconfig.json":
// - устанавливает корневой каталог проекта TypeScript;
// - выполняет настройку параметров компиляции;
// - устанавливает файлы проекта.
// Присутствие файла "tsconfig.json" в папке указывает TypeScript, что это корневая папка проекта.
// Внутри "tsconfig.json" указываются настройки компилятора TypeScript и корневые файлы проекта.
// Программа компилятора "tsc" ищет файл "tsconfig.json" сначала в папке, где она расположена, затем поднимается выше и ищет в родительских папках согласно их вложенности друг в друга.
// Команда "tsc --project C:\path\to\my\project\folder" берет файл "tsconfig.json" из папки, расположенной по данному пути.
// Файл "tsconfig.json" может быть полностью пустым, тогда компилятор скомпилирует все файлы с настройками заданными по умолчанию.
// Опции компилятора, перечисленные в командной строке перезаписывают собой опции, заданные в файле "tsconfig.json".
@tinker1987
tinker1987 / FixtureAwareTestCaseTrait.php
Last active September 1, 2017 14:00
Allow to load fixtures for integration tests
<?php
declare(strict_types=1);
namespace Tests;
use Doctrine\Common\DataFixtures\{
Executor\ORMExecutor, FixtureInterface, Purger\ORMPurger, SharedFixtureInterface
};
use Doctrine\Common\Persistence\ObjectManager;
use Symfony\Bridge\Doctrine\DataFixtures\ContainerAwareLoader;
@alexellis
alexellis / timelapse.md
Created March 9, 2017 08:48 — forked from porjo/timelapse.md
ffmpeg time-lapse

Convert sequence of JPEG images to MP4 video

ffmpeg -r 24 -pattern_type glob -i '*.JPG' -i DSC_%04d.JPG -s hd1080 -vcodec libx264 timelapse.mp4

  • -r 24 - output frame rate
  • -pattern_type glob -i '*.JPG' - all JPG files in the current directory
  • -i DSC_%04d.JPG - e.g. DSC_0397.JPG
  • -s hd1080 - 1920x1080 resolution

Slower, better quality

find . -type f | xargs -I {} bash -c "iconv -f utf-8 -t utf-16 {} &>/dev/null || echo {}" > utf8_fail
#!/bin/bash
PHP_V="$2";
if [ $PHP_V == "" ]; then
PHP_V=1
fi
__done(){
echo -e "Done\n";
}
@muendelezaji
muendelezaji / bash-to-zsh-hist.py
Created October 5, 2016 14:18 — forked from op/bash-history-to-zsh-history.py
Convert Bash history to Zsh history
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This is how I used it:
# $ cat ~/.bash_history | python bash-to-zsh-hist.py >> ~/.zsh_history
import sys
import time
@wilensky
wilensky / tomato_HPLJP1006_hotplug.sh
Last active August 7, 2016 10:50
Tomato firmware hotplug script for HP LaserJet P1006 printer
# Printer identity needs to be read separately by another hotplug script which prints id of plugged hardware
if [ $PRODUCT = "3f0/3e17/100" ]; then # `3f0/3e17/100` - printer identity
if [ $ACTION = "add" ]; then
sleep 1
cat /jffs/sihpP1006.dl > /dev/usb/lp0
fi
fi
<?php
$loader = require __DIR__.'/vendor/autoload.php';
use Longman\TelegramBot\Request;
$API_KEY = '--botfather-api-keu--';
$BOT_NAME = '--bofather-bot-name--';
$telegram = new Longman\TelegramBot\Telegram($API_KEY, $BOT_NAME);