Skip to content

Instantly share code, notes, and snippets.

View alexey-sh's full-sized avatar
❤️

Aleksey Shaposhnikov alexey-sh

❤️
  • Russia, Saint Petersburg
View GitHub Profile
@c-w
c-w / docker-entrypoint.sh
Last active April 12, 2024 04:22
Docker entrypoint that sources dotenv file secrets
#!/usr/bin/env sh
# This docker-entrypoint populates environment variables from docker secrets.
# The docker secrets are assumed to be files in dotenv syntax. The requested
# secrets should be declared in the environment variable DOTENV_SECRETS, with
# multiple secret names separated by a semi-colon.
if [ ! -d /run/secrets ]; then
exec "$@"
fi
@jasmas
jasmas / umbrellactl
Last active April 5, 2024 17:01
umbrellactl: Bash script to check status, enable or disable Cisco Umbrella Roaming Security Module for AnyConnect on MacOS
#!/usr/bin/env bash
PLUGIN_BASE='/opt/cisco/secureclient/bin/plugins'
read -r -d '' USAGE << EGASU
Usage: `basename $0` [-s|-e|-d|-h]
-s, --status Print Umbrella Roaming Security module status
-e, --enable Enable Umbrella Roaming Security module
-d, --disable Disable Umbrella Roaming Security module
@yefim
yefim / Dockerrun.aws.json
Last active April 7, 2023 16:11
Build a Docker image, push it to AWS EC2 Container Registry, then deploy it to AWS Elastic Beanstalk
{
"AWSEBDockerrunVersion": "1",
"Image": {
"Name": "<AWS_ACCOUNT_ID>.dkr.ecr.us-east-1.amazonaws.com/<NAME>:<TAG>",
"Update": "true"
},
"Ports": [
{
"ContainerPort": "443"
}
@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@paulirish
paulirish / what-forces-layout.md
Last active April 24, 2024 12:47
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@transitive-bullshit
transitive-bullshit / image-service.js
Last active November 12, 2021 12:22
Angular service to resize images with antialiasing for use with canvas.
angular.module('demo').service('imageService', function ($http, $q, $timeout) {
var NUM_LOBES = 3
var lanczos = lanczosGenerator(NUM_LOBES)
// resize via lanczos-sinc convolution
this.resize = function (img, width, height) {
var self = { }
self.type = "image/png"
self.quality = 1.0