Often you need to run debugger within docker. It many cases it looks like this:
import pdb; pdb.set_trace()Or:
| #!/bin/bash | |
| cd $1 | |
| echo Pulling branches | |
| git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done | |
| echo Cleaning | |
| for BRANCH in $(git branch --merged| egrep -v "(^\*|master|develop)") | |
| do | |
| git branch -d $BRANCH | |
| git push --delete origin $BRANCH |
| from troposphere import \ | |
| AWSHelperFn, Base64, Cidr, Condition, Equals, GetAtt, Join, Not, Output, Parameter, Ref, \ | |
| Region, Select, Split, StackName, Sub, Tags, Template | |
| from troposphere.autoscaling import \ | |
| AutoScalingGroup, LaunchTemplateSpecification, LifecycleHookSpecification | |
| from troposphere.awslambda import \ | |
| Code, Function, Permission | |
| from troposphere.ec2 import \ | |
| CreditSpecification, IamInstanceProfile, InternetGateway, LaunchTemplate, LaunchTemplateData, \ | |
| Route, RouteTable, SecurityGroup, SecurityGroupRule, Subnet, SubnetRouteTableAssociation, VPC, \ |
| # Install ARCH Linux with encrypted file-system and UEFI | |
| # The official installation guide (https://wiki.archlinux.org/index.php/Installation_Guide) contains a more verbose description. | |
| # Download the archiso image from https://www.archlinux.org/ | |
| # Copy to a usb-drive | |
| dd if=archlinux.img of=/dev/sdX bs=16M && sync # on linux | |
| # Boot from the usb. If the usb fails to boot, make sure that secure boot is disabled in the BIOS configuration. | |
| # Set swedish keymap |
| --- Actions --- | |
| $Copy <M-C> | |
| $Cut <M-X> <S-Del> | |
| $Delete <Del> <BS> <M-BS> | |
| $LRU | |
| $Paste <M-V> | |
| $Redo <M-S-Z> <A-S-BS> | |
| $SearchWeb <A-S-G> | |
| $SelectAll <M-A> | |
| $Undo <M-Z> |
| #!/bin/bash | |
| set -o errexit | |
| set -o nounset | |
| echo "Configuring psql with improved performance..." | |
| sed -ri "s/^#*(fsync\s*=\s*)\S+/\1 off/" "$PGDATA"/postgresql.conf | |
| sed -ri "s/^#*(full_page_writes\s*=\s*)\S+/\1 off/" "$PGDATA"/postgresql.conf | |
| sed -ri "s/^#*(random_page_cost\s*=\s*)\S+/\1 2.0/" "$PGDATA"/postgresql.conf |
| import logging | |
| import requests | |
| import contextlib | |
| try: | |
| from http.client import HTTPConnection # py3 | |
| except ImportError: | |
| from httplib import HTTPConnection # py2 | |
| #!/usr/bin/env bash | |
| # php7 from source with xdebug support for php dev env | |
| # install system dependecies TODO: CHECK | |
| apt-get update | |
| apt-get install | |
| apt-get -y install build-essential autoconf insserv bison git | |
| apt-get -y install libgmp-dev libmysqlclient-dev libfcgi-dev libfcgi0ldbl libmcrypt-dev \ | |
| libxml2-dev libxml2 libssl-dev libbz2-dev libcurl4-gnutls-dev libjpeg62-turbo-dev libjpeg-dev \ |
I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6
apt-get update && apt-get install gdb