Skip to content

Instantly share code, notes, and snippets.

@steve-jansen
steve-jansen / README.md
Last active December 13, 2024 23:29
Stop and start Symantec Endpoint Protection on OS X

This script enables you stop and start Symantec Endpoint Protection on OS X

Installation

sudo curl https://gist.githubusercontent.com/steve-jansen/61a189b6ab961a517f68/raw/sep -o /usr/local/bin/sep
sudo chmod 755 /usr/local/bin/sep
sudo chown root:staff /usr/local/bin/sep
@samukasmk
samukasmk / encrypt_decrypt_salt.sh
Created February 2, 2015 14:16
Encrypt and decrypt a string (With SALT Password - AES-128-cdc)
# ENCRYPTING WITH PRE-DEFINED (SALT PASSWORD)
$ echo 'this is my password' | openssl enc -aes-128-cbc -a -salt -pass pass:HereIsMySalt
U2FsdGVkX19+mJ+opjDjbw8Y6fmCtIznZI8lG1/+xs87youRvvZUzIlSiCMysoOl
# DECRYPTING WITH PRE-DEFINED (SALT PASSWORD)
$ echo 'U2FsdGVkX19+mJ+opjDjbw8Y6fmCtIznZI8lG1/+xs87youRvvZUzIlSiCMysoOl' | openssl enc -aes-128-cbc -a -d -salt -pass pass:HereIsMySalt
this is my password
# EXAMPLE OF DECRYPTING WITH WRONG SALT PASSWORD, GENERATING ERROR
$ echo 'U2FsdGVkX19+mJ+opjDjbw8Y6fmCtIznZI8lG1/+xs87youRvvZUzIlSiCMysoOl' | openssl enc -aes-128-cbc -a -d -salt -pass pass:PassingWrongSalt
@ajsharp
ajsharp / migrate-route53-dns
Last active July 3, 2023 18:35
This script makes it very easy to migrate an entire DNS zone from one AWS Route53 zone to another. This script expects you to have downloaded the old zone file via the AWS CLI to a json file called DOMAIN.zone.json. It uses the AWS CLI to perform the request, so make sure that your credentials are properly configured.
#!/usr/bin/env ruby
require 'json'
# This is the json output of the old zone, fetched using the AWS CLI.
zone = JSON.parse(File.read('DOMAIN.zone.json'))['ResourceRecordSets']
new_zone_id = 'NEW_ZONE_ID'
# We don't want to migrate the SOA and NS records from the old zone.
# http://qiita.com/uchiko/items/f6b1528d7362c9310da0
function peco-select-history() {
local tac
if which tac > /dev/null; then
tac="tac"
else
tac="tail -r"
fi
BUFFER=$(\history -n 1 | \
eval $tac | \
@volure
volure / SSH: Self Sign Postfix
Last active October 25, 2024 21:10
Create a Self Signed Postfix Certificate
# copied from https://www.e-rave.nl/create-a-self-signed-ssl-key-for-postfix
openssl genrsa -des3 -out mail.domain.tld.key 2048
chmod 600 mail.domain.tld.key
openssl req -new -key mail.domain.tld.key -out mail.domain.tld.csr
openssl x509 -req -days 365 -in mail.domain.tld.csr -signkey mail.domain.tld.key -out mail.domain.tld.crt
openssl rsa -in mail.domain.tld.key -out mail.domain.tld.key.nopass
mv mail.domain.tld.key.nopass mail.domain.tld.key
openssl req -new -x509 -extensions v3_ca -keyout cakey.pem -out cacert.pem -days 3650
chmod 600 mail.domain.tld.key
@mtbdeano
mtbdeano / split_horizonator.py
Created June 29, 2015 21:10
Simple python script to keep Amazon Route 53 public/private split horizon DNS domains in sync
import boto.route53
import boto.ec2
import pprint as pp
def match_domain(domain, region="us-east-1"):
''' iterate through the public EIPs and make sure that if there is a `domain.com` entry for that EIP, it's private IP is also mapped in the private `domain.com`
'''
r53 = boto.route53.connect_to_region(region)
ec2 = boto.ec2.connect_to_region(region)
@justinclayton
justinclayton / add-dns-record.sh
Created July 15, 2015 22:04
CLI to add DNS Records in Route53
#!/bin/bash -eo pipefail
## Allows for creation of "Basic" DNS records in a Route53 hosted zone
function main() {
record_name=$1
record_value=$2
[[ -z $record_name ]] && echo "record_name is: $record_name" && exit 1
[[ -z $record_value ]] && echo "record_value is: $record_value" && exit 1
@pcn
pcn / example.md
Last active September 14, 2023 19:40
Using jq to get+filter aws data

I've been playing with jq, and I've been having a hard time finding examples of how it works with output from a service like AWS (which I use a lot).

Here is one I use a lot with vagrant-ec2.

When we're launching and killing a lot of instances, the AWS API is the only way to track down which instances are live, ready, dead, etc.

To find instances that are tagged with e.g. {"Key" = "Name", "Value" = "Web-00'} in the middle of a vagrant dev cycle, or a prod launch/replace cycle, you can do something like this:

Docker Container Name

A one paragraph description about the container.

Getting Started

These instructions will cover usage information and for the docker container

Prerequisities

@ruseel
ruseel / aws-docker-high-tracffic-kernel.md
Last active May 24, 2024 14:18
AWS에서 docker를 쓸 때 high traffic server라면 이렇게

AWS에서 docker를 쓸 때 high traffic server라면 이렇게 하는 것이 좋겠다. amazon linux를 쓴다고 하자.

ulimit

ulimit를 올려주어야 한다. /etc/security/limit.conf 에서 고쳐주어도 docker에는 적용되지 않는다. limit.conf는 PAM을 통해서 로그인했을 때만 먹는 설정이라 그렇다. docker로 띄운 process의 pid를 찾고 cat /proc/<pid>/limits를 실행해서 보면 적용되었는지 아닌지 확실하게 알 수 있다. kernel에서 직접 그 프로세스에 어떤 ulimit이 적용되었는지 확인하는 방법이다.

그래서 /etc/sysconfig/docker 파일을 만들고 아래를 추가한다.