Skip to content

Instantly share code, notes, and snippets.

@PowerKiKi
PowerKiKi / nginx.conf
Last active December 23, 2020 20:21
Angular Universal SSR with i18n - `yarn dev-ssr` does not work (yet), but production does work and so should pm2
# Everything else that does not exists on disk redirect to Angular
location ~ ^/(?<selectedLanguage>ar|br|cs|de|en|es|fr|is|it|ku|lb|pl|pt|zh) {
# If bot, give a SSR prerendered page
error_page 419 = @ssr;
if ($http_user_agent ~* "yahoo|bingbot|baiduspider|yandex|yeti|yodaobot|gigabot|facebookexternalhit|twitterbot") {
return 419;
}
try_files $uri /$selectedLanguage/index.html?$args;
}
@igortik
igortik / nginx.conf
Last active June 3, 2024 04:00
Nginx optimized configuration with DDoS mitigation
user nginx;
# one(1) worker or equal the number of _real_ cpu cores. 4=4 core cpu
worker_processes 4;
# renice workers to reduce priority compared to system processes for
# machine health. worst case nginx will get ~25% system resources at nice=15
worker_priority -5;
@nagoodman
nagoodman / s3bucketcreate
Created December 21, 2011 23:02
Create S3 Bucket using Knox
// Create S3 bucket
var s3client = dynAws.getKnoxClient("bucketname");
var httpReq = s3client.put("/", {});
httpReq.on('response', function (response) {
// 200 indicates successful bucket creation
console.log(response.statusCode);
}).end();
@coolaj86
coolaj86 / how-to-publish-to-npm.md
Last active June 9, 2024 23:19
How to publish packages to NPM

Getting Started with NPM (as a developer)

As easy as 1, 2, 3!

Updated:

  • Aug, 08, 2022 update config docs for npm 8+
  • Jul 27, 2021 add private scopes
  • Jul 22, 2021 add dist tags
  • Jun 20, 2021 update for --access=public
  • Sep 07, 2020 update docs for npm version