Skip to content

Instantly share code, notes, and snippets.

@tboerger
tboerger / gist:4840e1b5464fc26fbb165b168be23345
Created February 17, 2017 09:37
Golang LDAP search and authentication
package main
import (
"fmt"
"strings"
"gopkg.in/ldap.v2"
)
const (
ldapServer = "ad.example.com:389"
@alekseykulikov
alekseykulikov / index.md
Last active April 14, 2024 00:32
Principles we use to write CSS for modern browsers

Recently CSS has got a lot of negativity. But I would like to defend it and show, that with good naming convention CSS works pretty well.

My 3 developers team has just developed React.js application with 7668 lines of CSS (and just 2 !important). During one year of development we had 0 issues with CSS. No refactoring typos, no style leaks, no performance problems, possibly, it is the most stable part of our application.

Here are main principles we use to write CSS for modern (IE11+) browsers:

@mechcozmo
mechcozmo / IAM Permissions List.md
Last active May 28, 2024 22:58
A list of IAM permissions you can use in policy documents. Collected from the myriad of places Amazon hides them. (incomplete)
@ralph-tice
ralph-tice / gist:bc8f66c4fe1d4238ce54c54272fc4ba2
Last active April 1, 2020 10:03
Resizing a Kafka cluster via bash
#!/bin/bash -xe
# requires jq and 3 brokers to start
which jq || echo 'no jq found, bye!' && exit 1
ZK_HOST=zkhost1:2181/kafka
# record all topics
/usr/local/kafka/bin/kafka-topics.sh --zookeeper $ZK_HOST --list > all_topics
# generate json for listing which topics to reassign
@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"
}
@elsonrodriguez
elsonrodriguez / README.md
Last active June 16, 2023 14:46
Example README.md for a helm Chart.

foo

This chart installs foo, the app with the most bar. This is just a standard foo setup.

Configuration

Secrets

The following secrets are configurable:

@zimme
zimme / Folder structure
Last active October 9, 2015 20:16
Meteor project structure
.
├── README.md
├── addresses
│   └── lib
│   ├── collections.coffee
│   └── schemas.coffee
├── client
│   ├── config
│   │   ├── bootstrap-growl.coffee
│   │   └── bootstrap-growl.less
@sebsto
sebsto / gist:468670c7c0d5feeade69
Created March 20, 2015 07:53
AWS CLI : discover your service limits from the command line
aws support describe-trusted-advisor-check-result --check-id eW7HH0l7J9 --query 'result.sort_by(flaggedResources[?status!="ok"],&metadata[2])[].metadata' --output table --region us-east-1
@O-I
O-I / hash_except.md
Last active August 2, 2023 17:31
[TIx 4] Remove key-value pairs from a hash and return the hash

Note: As of Ruby 3.0.0, Hash#except is now [part][1] of the language. However, Ruby does not implement Hash#except!.

Sometimes I want to remove a specific key-value pair from a Ruby hash and get the resulting hash back. If you're using Rails or ActiveSupport you can accomplish this using Hash#except:

hash = { a: 1, b: 2, c: 3 }
hash.except(:a)     # => { b: 2, c: 3 }

# note, the original hash is not modified
hash # =&gt; { a: 1, b: 2, c: 3 }
@skippy
skippy / cloud-config.yml
Created December 31, 2014 18:38
modifying fleet metadata (from aws meta-data service) before fleet.service start; this is a proof of concept (but it works!)
#cloud-config
---
coreos:
units:
- name: update-fleet-metadata.service
command: start
content: |-
[Unit]
Description=Update Fleet metadata tag
Before=fleet.service