Skip to content

Instantly share code, notes, and snippets.

@grengojbo
grengojbo / bitbucket-pipelines.yml
Created January 26, 2020 10:22 — forked from tstrohmeier/bitbucket-pipelines.yml
AWS ECS: Script for creating a new revision of a task definition and update a service
# enable Docker for your repository
options:
docker: true
pipelines:
branches:
development:
- step:
# python image with aws-cli installed
#!/bin/bash
systemctl stop docker-latest.service
atomic storage reset
wget -O /etc/sysconfig/docker-storage-setup https://gist.githubusercontent.com/grengojbo/e5d24322ddfa4997e8f7342f6d775197/raw/db49ff1377bd8e468f6ae69d8b32adbbac8e1449/docker-storage-setup
wget https://gist.githubusercontent.com/grengojbo/bcdf5e347b3c3dae7dc5e204f41265d2/raw/741e316fd42457c50724f5a35941bdaedde49692/docker-latest.service -O /etc/systemd/system/docker-latest.service
systemctl daemon-reload
rm -rf /var/lib/docker
rm -rf /var/lib/docker-latest
atomic storage modify --driver overlay2 --graph /var/lib/docker
echo "---------------------------------------"
[Unit]
Description=Docker Application Container Engine
Documentation=http://docs.docker.com
After=network.target
Wants=docker-storage-setup.service
[Service]
Type=notify
NotifyAccess=all
EnvironmentFile=-/etc/sysconfig/docker
# Edit this file to override any configuration options specified in
# /usr/lib/docker-storage-setup/docker-storage-setup.
#
# For more details refer to "man docker-storage-setup"
#CONTAINER_THINPOOL=docker-pool
STORAGE_DRIVER=overlay2
DEVS=/dev/sdb
CONTAINER_ROOT_LV_NAME=data
CONTAINER_ROOT_LV_SIZE=100%FREE
CONTAINER_ROOT_LV_MOUNT_PATH=/var/lib/docker
@grengojbo
grengojbo / building node-webkit on armv7 hardfp
Created February 4, 2017 12:16 — forked from xdenser/building node-webkit on armv7 hardfp
Building node webkit v0.9.2 on Odroid U3
sudo apt-get install libatk1.0-0 libc6 libasound2 libcairo2 libcups2 libexpat1 libfontconfig1 libfreetype6 libglib2.0-0 libgnome-keyring0 libgtk2.0-0 libpam0g libpango1.0-0 libpci3 libpcre3 libpixman-1-0 libpng12-0 libspeechd2 libstdc++6 libsqlite3-0 libx11-6 libxau6 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxdmcp6 libxext6 libxfixes3 libxi6 libxinerama1 libxrandr2 libxrender1 libxtst6 zlib1g apache2.2-bin bison curl elfutils fakeroot flex g++ gperf libapache2-mod-php5 libasound2-dev libbz2-dev libcairo2-dev libcups2-dev libcurl4-gnutls-dev libelf-dev libgconf2-dev libgl1-mesa-dev libglib2.0-dev libglu1-mesa-dev libgnome-keyring-dev libgtk2.0-dev libkrb5-dev libnspr4-dev libnss3-dev libpam0g-dev libpci-dev libpulse-dev libsctp-dev libspeechd-dev libsqlite3-dev libssl-dev libudev-dev libwww-perl libxslt1-dev libxss-dev libxt-dev libxtst-dev mesa-common-dev metacity patch perl php5-cgi pkg-config python python-cherrypy3 python-dev python-psutil rpm ruby subversion ttf-dejavu-core ttf-indic-fonts ttf-koc
@grengojbo
grengojbo / db-backup
Last active November 13, 2016 18:49 — forked from matthewlehner/autopgsqlbackup
Auto PostgreSQL backup script.
#!/bin/bash
#
# PostgreSQL Backup Script Ver 1.0
# http://autopgsqlbackup.frozenpc.net
# Copyright (c) 2005 Aaron Axelsen <axelseaa@amadmax.com>
#
# This script is based of the AutoMySQLBackup Script Ver 2.2
# It can be found at http://sourceforge.net/projects/automysqlbackup/
#
# The PostgreSQL changes are based on a patch agaisnt AutoMySQLBackup 1.9
import (
"code.google.com/p/go.text/transform"
"code.google.com/p/go.text/encoding/charmap"
)
func main() {
sr := strings.NewReader("Текст в Win1251")
tr := transform.NewReader(sr, charmap.Windows1251.NewDecoder())
buf, err := ioutil.ReadAll(tr)

コマンド

set policy route PPPOE-IN rule 10 destination address 0.0.0.0/0
set policy route PPPOE-IN rule 10 protocol tcp
set policy route PPPOE-IN rule 10 tcp flags 'SYN,!ACK,!FIN,!RST'
set policy route PPPOE-IN rule 10 set tcp-mss 1414
set interface ethernet eth0 policy route PPPOE-IN

/sbin/iptables -L -n -t mangle

@grengojbo
grengojbo / gist:b4aa1ffd467c2a8bd358
Last active August 29, 2015 14:18 — forked from dwiash/gist:6404554
Smartfren CE81B Modem
# put this following lines into /etc/udev/rules.d/haier-port-blacklist.rules
ACTION!="add|change", GOTO="mm_haier_port_types_end"
SUBSYSTEM!="tty", GOTO="mm_haier_port_types_end"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="201e", GOTO="mm_haier_vendorcheck"
GOTO="mm_haier_port_types_end"
LABEL="mm_haier_vendorcheck"
SUBSYSTEMS=="usb", ATTRS{bInterfaceNumber}=="?*",
#!/bin/bash -e
fleetctl list-units -fields=unit -no-legend | grep -v -e '@\|deis' | cut -d. -f1-2 | sort | uniq | while read name ; do
max=$(fleetctl list-machines -no-legend | wc -l)
count=$(fleetctl list-units -fields=unit -no-legend | grep -e "^$name" | wc -l)
if [ $count -gt $max ]; then
echo "Skipping $name, there are $count deployed units on $max fleet machines"
else
echo "Processing $name"
fleetctl list-units -fields=unit -no-legend | grep -e "^$name" | while read service; do
others=$(echo $service | cut -d. -f1-2)