start new:
tmux
start new with session name:
tmux new -s myname
| #!/usr/bin/env python | |
| # -- coding: utf-8 -- | |
| """Deployment script. | |
| This script is coded so it can make the deployments automagically in the | |
| designed servers, it also works as a documentation of where are the programs | |
| installed. | |
| USE: fab <hosts>:<username> <action> | |
| EX: fab staging:admin release |
| echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc | |
| . ~/.bashrc | |
| mkdir ~/local | |
| mkdir ~/node-latest-install | |
| cd ~/node-latest-install | |
| curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 | |
| ./configure --prefix=~/local | |
| make install # ok, fine, this step probably takes more than 30 seconds... | |
| curl https://www.npmjs.org/install.sh | sh |
| #!/bin/sh | |
| # | |
| # Shell script that configures gnome-terminal to use solarized theme | |
| # colors. Written for Ubuntu 11.10, untested on anything else. | |
| # | |
| # Solarized theme: http://ethanschoonover.com/solarized | |
| # | |
| # Adapted from these sources: | |
| # https://gist.github.com/1280177 | |
| # http://xorcode.com/guides/solarized-vim-eclipse-ubuntu/ |
| # coding=utf-8 | |
| from tastypie.bundle import Bundle | |
| from tastypie import fields | |
| from tastypie.exceptions import ApiFieldError | |
| class OptimizedToOneField(fields.ToOneField): | |
| def dehydrate(self, bundle, **kwargs): | |
| """ |
| # Copyright (c) 2014 Andrey Vlasovskikh | |
| # | |
| # Permission is hereby granted, free of charge, to any person obtaining a copy | |
| # of this software and associated documentation files (the "Software"), to deal | |
| # in the Software without restriction, including without limitation the rights | |
| # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| # copies of the Software, and to permit persons to whom the Software is | |
| # furnished to do so, subject to the following conditions: | |
| # | |
| # The above copyright notice and this permission notice shall be included in |
| cat data.json | jq -c -M '.data[]' | \ | |
| while read line; do echo $line > parts/$(date +%s%N).json; done |
| #!/usr/bin/env python | |
| # coding: utf-8 | |
| from os import system | |
| PROJECT_PATH = 'path_to_your_project' | |
| ACTIVATE_VENV = '. path_to_your_virtualenv/bin/activate' | |
| def tmux(command): |
| #!/usr/bin/env python2.7 | |
| from __future__ import print_function | |
| import commands | |
| import os | |
| import stat | |
| from gitlab import Gitlab | |
| def get_clone_commands(token, repo_root): | |
| con = Gitlab("http://gitlab.your.domain", token) |
| from unittest.mock import patch | |
| from django.urls import reverse | |
| from django.tests import TestCase | |
| class TestGitHubWebhookView(TestCase): | |
| @patch('my_app.views.GitHubWebhookView.ping') | |
| def test_view_ping_event(self, mock_ping): |