This file contains hidden or 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
| #!/bin/bash | |
| iptables -t nat -A PREROUTING -p tcp --dport $PORT -j DNAT --to-destination $TARGET:$PORT | |
| iptables -t nat -A POSTROUTING -j MASQUERADE |
This file contains hidden or 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
| /:locale(ru|uk)? |
This file contains hidden or 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
| function localize ([fallback, ...other], b) { | |
| return [...b('', '')].concat(...other.map(x => b(`/${x}/`, `${x}-`))) | |
| } |
This file contains hidden or 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
| function generateSearchTreeByFields(array, fields) { | |
| const result = {} | |
| for (const item of array) { | |
| for (let i = 0, field = result; i < fields.length; i += 1) { | |
| field = field[item[fields[i]]] = (i === fields.length - 1) ? item : (field[item[fields[i]]] || {}) | |
| } | |
| } | |
| return result | |
| } |
This file contains hidden or 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
| // function components (path, name, components, options = {}) { | |
| // return { | |
| // name, | |
| // path, | |
| // components, | |
| // ...options | |
| // } | |
| // } |
This file contains hidden or 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 router from '@/router' | |
| const userKey = 'user' | |
| const refreshAction = 'sessions/refresh' | |
| const logoutAction = 'sessions/logout' | |
| const updateMutations = [ | |
| 'sessions/LOGIN', | |
| 'sessions/LOGOUT', | |
| 'sessions/SIGNUP' | |
| ] |
This file contains hidden or 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
| # Under bastion | |
| route add default gw $PRIVATE_GW | |
| # On Bastion | |
| iptables -t nat -A POSTROUTING -p tcp -o $PUBLIC_IF -j SNAT --to-source $ANCHOR_IP | |
| modprobe iptable_nat | |
| echo 1 > /proc/sys/net/ipv4/ip_forward | |
| iptables -t nat -A POSTROUTING -o $PUBLIC_IF -j MASQUERADE | |
| iptables -A FORWARD -i $PRIVATE_IF -j ACCEPT |
This file contains hidden or 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 | |
| type Sequencer struct { | |
| sync.Mutex | |
| tasks map[string]chan string | |
| } | |
| func (t *Sequencer) run(msg string) { | |
| for { | |
| select { |
This file contains hidden or 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
| type consumer struct { | |
| url string | |
| queue string | |
| stop chan struct{} | |
| wg sync.WaitGroup | |
| deliveries chan<- amqp.Delivery | |
| } | |
| func (e *consumer) Stop() { |
This file contains hidden or 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
| type publisher struct { | |
| url string | |
| chPool chan *amqp.Channel | |
| } | |
| func (c *publisher) init() error { | |
| conn, err := amqp.Dial(c.url) | |
| if err != nil { | |
| return err |
NewerOlder