Personal
Squid Proxy Server with Restricted Access , Error no internet
1 2 3 4 5 6 7 8 9 10 |
acl localhost src 127.0.0.1/32 acl localnet src 192.168.0.0/24 http_access allow localnet http_access allow localhost http_access allow all #!! Delete the deny all. !! |
!! ////
1 2 3 4 5 6 7 |
acl RestrictedHost src 192.168.1.23 # # Add this at the top of the http_access section of squid.conf # http_access deny RestrictedHost http_access allow home_network business_hours |
Restricting Access to specific Web sites
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File: /usr/local/etc/allowed-sites.squid www.kutayzorlu.com # File: /usr/local/etc/restricted-sites.squid www.illegal.com # # Add this to the bottom of the ACL section of squid.conf # acl home_network src 192.168.1.0/24 acl business_hours time M T W H F 5:00-13:00 acl allowed dstdomain "/usr/local/etc/allowed-sites.squid" acl denied dstdomain "/usr/local/etc/restricted-sites.squid" # # Add this at the top of the http_access section of squid.conf # http_access deny denied http_access allow allowed # kutayzorlu.com |
DHCP server with NAT
# DHCP Client
#1. DHCP sunucusuna giren adamin, ping atabilmesi icin, asagidaki komutu yazmasi gerekir. NAmeserver olarak dhcp sunucusunu vermesi gerekir.
nameserver 172.20.0.1
# bunu yazdiktan sonra ping atiyor. ama Dosya indiremiyor.
DHCP SERVER
# If the client wants to connect internet, The DHCP server should enable ip forwarding, after that
should SET default GATeway to NAT router GW.
route add default gw 192.168.122.1
route add default gw 192.168.122.1
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.122.1 0.0.0.0 UG 0 0 0 eth2
0.0.0.0 172.20.0.1 0.0.0.0 UG 0 0 0 eth0
172.10.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
OPC C# .NET
Soon,
i moved server, ASAP i will put it here. With all projects.
This is the first message from me,
I start everything from “0”.
Best Regards.
LastOrDefault: Where an Element Is Not Found
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
using System; using System.Linq; using System.Collections; using System.Collections.Generic; public class Employee { public int id; public string firstName; public string lastName; public static ArrayList GetEmployeesArrayList() { ArrayList al = new ArrayList(); al.Add(new Employee { id = 1, firstName = "J", lastName = "R" }); al.Add(new Employee { id = 2, firstName = "W", lastName = "G" }); al.Add(new Employee { id = 3, firstName = "A", lastName = "H" }); al.Add(new Employee { id = 4, firstName = "D", lastName = "L" }); al.Add(new Employee { id = 101, firstName = "K", lastName = "F" }); return (al); } public static Employee[] GetEmployeesArray() { return ((Employee[])GetEmployeesArrayList().ToArray(typeof(Employee))); } } public class MainClass { public static void Main() { Employee emp = Employee.GetEmployeesArray().LastOrDefault(e => e.id == 5); Console.WriteLine(emp == null ? "NULL" : string.Format("{0} {1}", emp.firstName, emp.lastName)); } } |
uses Skip to get all but the first 4 elements of the array.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
using System; using System.Collections.Generic; using System.Linq; using System.Text; public class MainClass{ public static void Main() { int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7}; var allButFirst4Numbers = numbers.Skip(4); Console.WriteLine("All but first 4 numbers:"); foreach (var n in allButFirst4Numbers) { Console.WriteLine(n); } } } |