Skip to content

Instantly share code, notes, and snippets.

@bpourriahi
bpourriahi / snat_dnat_advantech.md
Created Sep 16, 2020 — forked from tomasinouk/snat_dnat_advantech.md
examples of SNAT, DNAT with iptables for Advantech, Conel routers, with comments (probably will work on other routers where iptables can be manipulated, care needs to be taken on applying these commands after reboot)
View snat_dnat_advantech.md

Some examples of SNAT, DNAT with iptables with comments

mainly used in start-up script

masquarade all outgoing packets to be WLAN0 IP

iptables -t nat -A PREROUTING -s 192.168.1.2 -i eth0 -j MASQUERADE

All packets leaving eth0 will have src eth0 ip address

@bpourriahi
bpourriahi / useradd.sh
Created Sep 12, 2020 — forked from igorvoltaic/useradd.sh
Create new user using command line in Mac OS X. Do not forget to set correct permissions for the file.
View useradd.sh
#!/bin/sh
if [[ `id -u` != 0 ]]; then
echo "Must be root to run script"
exit
fi
read -p "Enter user name and press [ENTER]: " UserName
if [[ $UserName == `dscl . -list /Users UniqueID | awk '{print $1}' | grep -w $UserName` ]]; then
View gist:edb22bbff00cff75be8b
select
p.*
,STUFF((
SELECT DISTINCT ', ' + MEM_ID + ':' + CAST([Value] AS VARCHAR(MAX))
FROM MEMBER_TABLE
WHERE (ID = p.SUPP_NAME)
FOR XML path('')
) AS MemberIDss
,STUFF((
SELECT DISTINCT ', ' + SUPP_NAME + ':' + CAST([Value] AS VARCHAR(MAX))
View config-unicorn_production.rb
env = "production"
worker_processes 2
listen "/tmp/my_app_production.socket"
preload_app true
timeout 30
pid "/tmp/unicorn.my_app_production.pid"
working_directory "/var/www/my_app/current"
user 'app_user', 'app_user'
shared_path = "/var/www/my_app/shared"
stderr_path "/var/log/unicorn/production/stderr.log"