This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"time" | |
"golang.org/x/time/rate" | |
) | |
func deploy(quotas map[string]*rate.Limiter, orga string, service string) bool { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AWX credentials are encrypted with django SECRET_KEY. | |
If you have access to the container `awx_web`, you can follow the following procedure to decrypt secrets. | |
$> docker exec -ti awx_web bash | |
$> source /var/lib/awx/venv/awx/bin/activate | |
$> awx-manage shell | |
$> python | |
>>> CREDENTIAL_ID = xxx # replace me | |
>>> from awx.main.models import Credential |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Infra: | |
- laptop | |
- server | |
- container where commands can be executed | |
Steps: | |
- install and run ssh on the container |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ip link add enp1s1 type gretap remote <other host> local <me> | |
ip link add link enp1s1 name enp1s1.1337 type vlan id 1337 | |
ip link set dev enp1s1 up | |
ip link set dev enp1s1.1337 up | |
ip addr add 10.0.0.1/24 dev enp1s1.1337 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""This snippet uses Scaleway APIs to: | |
- Create a PostgreSQL database | |
- Create a S3 bucket | |
- Create one loadbalancer | |
- Create 3 instances and install nginx with cloud-init | |
- Attach instances to the loadbalancer | |
Install dependencies with `pip install boto3 requests`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import argparse | |
import datetime | |
import re | |
import sys | |
SALT_LOGLINE_DATE_REGEXP = r'^(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2},\d{3})' | |
SALT_LOGLINE_DATE_FORMAT = '%Y-%m-%d %H:%M:%S,%f' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import pipes | |
def shell(json_input): | |
""" Flattens a JSON-dict as a list of key-value pairs. | |
For each key/value of the dictionary: | |
- "Simple" elements (strings, bools, integers) are represented as a string | |
"KEY=value". pipes.quote is used to handle escaping. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am brmzkw on github. | |
* I am jcastets (https://keybase.io/jcastets) on keybase. | |
* I have a public key ASCsYcb7hY6KnFaDkjc_5SpezhhOVWCkr-i8KNSCPgfNrAo | |
To claim this, I am signing this object: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DynPyDoc(type): | |
def __new__(cls, name, bases, attrs): | |
start_match = 'pydoc_for_' | |
for attr_name, attr_value in attrs.items(): | |
if attr_name.startswith(start_match): | |
method_name = attr_name[len(start_match):] |