| Assignment | |
|---|---|
Assign value to variable if variable is not already set, value is returned.Combine with a : no-op to discard/ignore return value. |
${variable="value"}: ${variable="value"} |
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
| # Version key/value should be on his own line | |
| PACKAGE_VERSION=$(cat package.json \ | |
| | grep version \ | |
| | head -1 \ | |
| | awk -F: '{ print $2 }' \ | |
| | sed 's/[",]//g') | |
| echo $PACKAGE_VERSION |
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
| /* | |
| C socket server example, handles multiple clients using threads | |
| Compile | |
| gcc server.c -lpthread -o server | |
| */ | |
| #include<stdio.h> | |
| #include<string.h> //strlen | |
| #include<stdlib.h> //strlen | |
| #include<sys/socket.h> |
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
| file, err := os.Open(path) | |
| if err != nil { | |
| return err | |
| } | |
| defer file.Close() | |
| // Only the first 512 bytes are used to sniff the content type. | |
| buffer := make([]byte, 512) | |
| _, err = file.Read(buffer) | |
| if err != nil { |
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
| # curl -LO http://wiki.alpinelinux.org/cgi-bin/dl.cgi/v3.3/releases/x86_64/alpine-3.3.1-x86_64.iso | |
| curl -LO http://wiki.alpinelinux.org/cgi-bin/dl.cgi/v3.3/releases/x86/alpine-3.3.1-x86.iso | |
| # create hdd image (8GB) | |
| dd if=/dev/zero of=hdd.img bs=1g count=8 | |
| # extract kernel and initramfs | |
| brew install cdrtools | |
| isoinfo -i alpine-3.3.1-x86.iso -J -x /boot/initramfs-grsec > initramfs-grsec | |
| isoinfo -i alpine-3.3.1-x86.iso -J -x /boot/vmlinuz-grsec > vmlinuz-grsec |
By: @BTroncone
Also check out my lesson @ngrx/store in 10 minutes on egghead.io!
Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!
Table of Contents
/.git/config
[remote "origin"]
url = ssh://[email protected]:7999/brikks/brikks.git
fetch = +refs/heads/*:refs/remotes/origin/*
fetch = +refs/pull-requests/*/from:refs/remotes/origin/pull-requests/*
fetch = +refs/pull-requests/*/merge:refs/remotes/origin/pull-requests-merge/*
This script is intended to automatically fix the sequence numbers for all tables in the current database.
This is accomplished through the use of the setval() command, which we provide with the next ID value we wish to make use of.
We use the setval(sequence, number, is_called) overload
and set is_called = false in conjunction with COALESCE(MAX + 1, 1) to ensure that, with an empty table, the next sequence
value is 1 as expected.
- install dnsmasq
$ brew install dnsmasq
...
$ cp /usr/local/opt/dnsmasq/dnsmasq.conf.example /usr/local/etc/dnsmasq.conf
- edit
/usr/local/etc/dnsmasq.conf
address=/local/127.0.0.1
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 | |
| interfaces=( $(netstat -in | egrep 'utun\d .*\d+\.\d+\.\d+\.\d+' | cut -d ' ' -f 1) ) | |
| rulefile="rules.tmp" | |
| echo "" > $rulefile | |
| sudo pfctl -a com.apple/tun -F nat | |
| for i in "${interfaces[@]}" | |
| do | |
| RULE="nat on ${i} proto {tcp, udp, icmp} from 192.168.64.0/24 to any -> ${i}" | |
| echo $RULE >> $rulefile | |
| done |