Enable forwarding:
sysctl -w net.ipv4.ip_forward=1
Create this script eg sudo nano iptables.sh
eth=$1
proto=$2
Enable forwarding:
sysctl -w net.ipv4.ip_forward=1
Create this script eg sudo nano iptables.sh
eth=$1
proto=$2
curl --include \ | |
--no-buffer \ | |
--header "Connection: Upgrade" \ | |
--header "Upgrade: websocket" \ | |
--header "Host: example.com:80" \ | |
--header "Origin: http://example.com:80" \ | |
--header "Sec-WebSocket-Key: SGVsbG8sIHdvcmxkIQ==" \ | |
--header "Sec-WebSocket-Version: 13" \ | |
http://example.com:80/ |
This is a quick guide for installing memcached on a Mac with Homebrew, and starting and stopping it with Lunchy. I hope this tutorial will get your memcached up and running in no time.
Installing Homebrew is super easy. Just paste this in your terminal —
$ ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...
// see: https://github.com/chadoe/docker-cleanup-volumes
$ docker volume rm $(docker volume ls -qf dangling=true)
$ docker volume ls -qf dangling=true | xargs -r docker volume rm
;; Elisp session in REPL IELM | |
;; | |
;; | |
;; | |
ELISP> (defmacro inc (var) | |
(list 'setq var (list '1+ var))) | |
inc | |
ELISP> (setq x 0) | |
0 (#o0, #x0, ?\C-@) |
mainly used in start-up script
When we play with iptables aka firewall we might end up in situation, where we execute rule, which has unforseen impact - lock yourself out. Recovering from this situation is necessity.
How to:
- Enable reboot via SMS.
- Test all commands in shell first before putting them into Start-up script. This way the command will be wiped out, when unit is rebooted.
#!/usr/bin/env bash | |
size=1024 # MB | |
mount_point=$HOME/tmp | |
name=$(basename "$mount_point") | |
usage() { | |
echo "usage: $(basename "$0") [mount | umount | remount | check | orphan]" \ | |
"(default: mount)" >&2 | |
} |
## | |
# @server studio | |
# @host hackisition.com | |
# @desc nginx host rules | |
# @author Julien Le Coupanec <[email protected]> | |
## | |
# HTTP Server | |
server { | |
listen 80; |
boost::shared_mutex _access; | |
void reader() | |
{ | |
boost::shared_lock< boost::shared_mutex > lock(_access); | |
// do work here, without anyone having exclusive access | |
} | |
void conditional_writer() | |
{ | |
boost::upgrade_lock< boost::shared_mutex > lock(_access); |
-(void) applicationDidEnterBackground:(UIApplication *) application | |
{ | |
// You will also want to check if the user would like background location | |
// tracking and check that you are on a device that supports this feature. | |
// Also you will want to see if location services are enabled at all. | |
// All this code is stripped back to the bare bones to show the structure | |
// of what is needed. | |
[locationManager startMonitoringSignificantLocationChanges]; |