Skip to content

Instantly share code, notes, and snippets.

@badfun
badfun / aws-custom-resource-example.ts
Last active May 27, 2022 21:52
AWS custom resources in the AWS CDK allow us to achieve functionality that might not be available otherwise. In this case, I needed a secure string parameter to be converted to a string that I could pass directly to a bash script. Any of the other lookups resulted in an error, as it would pass either the token itself or the encrypted string.
import { AwsCustomResource, AwsCustomResourcePolicy, PhysicalResourceId } from '@aws-cdk/custom-resources'
/**
* Secure string from Parameter store
*/
const getParameter = new AwsCustomResource(this, 'SsmSecureStringParameter', {
onUpdate: {
service: 'SSM',
action: 'getParameter',
parameters: {
@codejedi365
codejedi365 / README.md
Last active January 8, 2024 11:19
Configuring Typescript project with `ts-jest` & `jest-extended`

TS-JEST & JEST-EXTENDED SUPPORT

This gist is designed to explain how to configure a project where you have your test code separated from your codebase. The project file structure looks a bit like this:

project
├─┬ lib                    # could be src
│ ├── globals.d.ts         # source code specific type declarations
│ └── index.ts
├─┬ tests
@ericdouglas
ericdouglas / keyboard.md
Last active July 2, 2024 19:49
Cedilla under C (ç) in 'US international' keyboard layout in Linux

Add English (US, alt. intl.)

It's because the cedilla module isn't loaded by default when the locale is set to en, so you have to change the configuration files for gtk to add them:

  1. Edit configuration files:
sudo vim /usr/lib/x86_64-linux-gnu/gtk-3.0/3.0.0/immodules.cache

sudo vim /usr/lib/x86_64-linux-gnu/gtk-2.0/2.10.0/immodules.cache
@JAParsons
JAParsons / UbuntuHiDPI.md
Last active April 10, 2024 22:14 — forked from nma/UbuntuHiDPI.md
DPI Scaling Fix for Ubuntu on HiDPI 3840x2160 eDP1 with 1920x1080 External Monitor

Based on the contents http://blog.jamiek.it/2015/04/manually-fixing-multiple-screens-with.html

  • Set your Ubuntu to the highest DPI from the System Configurations
  • If not using Ubuntu, then you may need to configure based on instructions here and use a DPI calclator.
  • Please referer to the full blog post and give thanks to the OP.
  • This is just notes and a cached script for my personal laptop
  • My External Monitor (DP-2) is Above my Laptop Screen (eDP1)

Forked from: https://gist.github.com/nma/8125f585f4111e1e55caee83c03b94a6

wget -O /tmp/YaHei.Consolas.1.12.zip https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/uigroupcode/YaHei.Consolas.1.12.zip
unzip /tmp/YaHei.Consolas.1.12.zip
sudo mkdir -p /usr/share/fonts/consolas
sudo mv YaHei.Consolas.1.12.ttf /usr/share/fonts/consolas/
sudo chmod 644 /usr/share/fonts/consolas/YaHei.Consolas.1.12.ttf
cd /usr/share/fonts/consolas
sudo mkfontscale && sudo mkfontdir && sudo fc-cache -fv
@JPvRiel
JPvRiel / journalctl_enable_persistent_storage.md
Last active June 20, 2024 09:29
Enable persistent storage for the systemd journal log

Enable persistent storage for the systemd journal log

Overview

The assumed default setting in /etc/systemd/journald.conf is Storage=auto which implies that systemd journaling will only persist the journal if the expected storage location is available. Otherwise, the journal data is stored in memory and lost between reboots. On Ubuntu 16.04, /var/log/journal does not exist by default. Create it to keep and query events from previous boots.

Considerations:

  • Syslog still provides the persistant log records for Ubuntu 16.04, so enabling persistant systemd journal logging does cause a level of duplicaiton.
  • There are sane defaults:
@denji
denji / nginx-tuning.md
Last active July 1, 2024 10:24
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.