working on it ...

Filters

Explore Public Snippets

Sort by

Found 11k snippets matching: rule

    public by teslamint  234855  1  4  0

    modified version of coova-chilli patch for OpenWrt. This patch re-add firewall rules when reload firewall. https://lists.openwrt.org/pipermail/openwrt-devel/2012-December/018075.html

    modified version of coova-chilli patch for OpenWrt. This patch re-add firewall rules when reload firewall. https://lists.openwrt.org/pipermail/openwrt-devel/2012-December/018075.html: coova-1.3.0-custom.patch
    Index: files/chilli.init
    ===================================================================
    --- files/chilli.init   (리비전 0)
    +++ files/chilli.init   (리비전 0)
    @@ -0,0 +1,61 @@
    +#!/bin/sh /etc/rc.common
    +
    +START=30
    +STOP=90
    +
    +config_cb() {
    +    chilli_inst=$2
    +    if [ "$chilli_inst" != "" ]
    +    then
    +       rm -f /var/run/chilli_${chilli_inst}*
    +       chilli_conf=/var/run/chilli_${chilli_inst}.conf
    +       eval "start_chilli_$chilli_inst=1"
    +    fi
    +}
    +
    +option_cb() {
    +    case "$1" in
    +        # UCI settings
    +       network)
    +           . /lib/functions/network.sh
    +           local ifname
    +           network_get_device ifname $2
    +           echo "dhcpif=\"$ifname\"" >> $chilli_conf
    +           ;;
    +       disabled)
    +           eval "start_chilli_$chilli_inst=0"
    +           ;;
    +        # boolean settings
    +       dhcpbroadcast|nodynip|vlanlocation|locationstopstart|locationcopycalled|locationimmediateupdate|locationopt82|coanoipcheck|noradallow|proxymacaccept|proxyonacct|dhcpmacset|dhcpradius|noc2c|eapolenable|uamanydns|uamanyip|uamnatanyip|nouamsuccess|nowispr1|nowispr2|domaindnslocal|radsec|macauth|macreauth|macauthdeny|macallowlocal|strictmacauth|strictdhcp|ieee8021q|only8021q|radiusoriginalurl|swapoctets|statusfilesave|wpaguests|openidauth|papalwaysok|mschapv2|chillixml|acctupdate|dnsparanoia|seskeepalive|usetap|noarpentries|framedservice|scalewin|redir|injectwispr|redirurl|routeonetone|nousergardendata|uamgardendata|uamotherdata|withunixipc|uamallowpost|redirssl|uamuissl|layer3|patricia|redirdnsreq|dhcpnotidle|ipv6|ipv6only)
    +           [ "$2" = "true" -o "$2" = "1" ] && echo "$1" >> $chilli_conf
    +           ;;
    +       *)
    +           echo "$1=\"$2\"" >> $chilli_conf
    +           ;;
    +    esac
    +}
    +
    +start_chilli() {
    +    local cfg="$1"
    +    local start_chilli=$(eval "echo \$start_chilli_$cfg")
    +    [ "$start_chilli" = "0" ] && return
    +    local base=/var/run/chilli_${cfg}
    +    chilli -c ${base}.conf \
    +       --pidfile ${base}.pid \
    +       --cmdsocket ${base}.sock \
    +       --unixipc ${base}.ipc &
    +}
    +
    +start() {
    +    config_load chilli
    +    config_foreach start_chilli chilli
    +}
    +
    +stop() {
    +    ls /var/run/chilli*.pid 2>/dev/null && {
    +       kill $(cat /var/run/chilli*.pid)
    +       sleep 1
    +       killall -9 chilli &
    +       rm -f /var/run/chilli*
    +    }
    +}
    Index: files/chilli.firewall
    ===================================================================
    --- files/chilli.firewall       (리비전 0)
    +++ files/chilli.firewall       (리비전 0)
    @@ -0,0 +1,33 @@
    +#!/bin/sh
    +
    +chilli_firewall() {
    +    local cfg="$1"
    +    local tun ipup addr mask net dhcpif uamport uamuiport
    +
    +    config_get tun "$cfg" tundev
    +    config_get ipup "$cfg" ipup
    +    config_get addr "$cfg" uamlisten
    +    config_get net "$cfg" net
    +    config_get dhcpif "$cfg" dhcpif
    +    config_get uamport "$cfg" uamport
    +    config_get uamuiport "$cfg" uamuiport
    +
    +    if [ -f /var/run/chilli.$tun.sh ]; then
    +        [ "$(iptables -t filter -vL | grep $tun)" != "" ] && . /var/run/chilli.$tun.sh
    +        DEV=$tun
    +        ADDR=$addr
    +        MASK=255.255.255.0
    +        NET=$net
    +        DHCPIF=$dhcpif
    +        UAMPORT=$uamport
    +        UAMUIPORT=$uamuiport
    +        . $ipup
    +    fi
    +
    +}
    +
    +chilli_post_core_cb() {
    +    config_load chilli
    +    config_foreach chilli_firewall chilli
    +}
    +
    Index: Makefile
    ===================================================================
    --- Makefile    (리비전 37020)
    +++ Makefile    (작업 사본)
    @@ -8,16 +8,13 @@
     include $(TOPDIR)/rules.mk
    
     PKG_NAME:=coova-chilli
    -PKG_VERSION:=1.2.9
    +PKG_VERSION:=1.3.0
     PKG_RELEASE:=1
    
     PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
    -PKG_SOURCE_URL:=http://ap.coova.org/chilli
    -PKG_MD5SUM:=a493d0562fc3b05fe86d8ad65f7f2dc0
    +PKG_SOURCE_URL:=http://coova-chilli.s3.amazonaws.com/
    +PKG_MD5SUM:=dc0037e3cdebcb60508081b4e42e984a
    
    -PKG_FIXUP:=autoreconf
    -PKG_INSTALL:=1
    -
     include $(INCLUDE_DIR)/package.mk
    
     define Package/coova-chilli
    @@ -25,33 +22,102 @@
       SECTION:=net
       CATEGORY:=Network
       DEPENDS:=+kmod-tun +librt
    -  TITLE:=Wireless LAN HotSpot controller (Coova Chilli Version)
    -  URL:=http://www.coova.org/CoovaChilli
    +  TITLE:=Wireless LAN HotSpot controller
    +  URL:=http://www.coova.org/
     endef
    
    +define Package/coova-chilli-miniportal
    +  SUBMENU:=Captive Portals
    +  SECTION:=net
    +  CATEGORY:=Network
    +  DEPENDS:=+coova-chilli
    +  TITLE:=CoovaChilli MiniPortal
    +  URL:=http://www.coova.org/
    +endef
    +
     define Package/coova-chilli/description
            CoovaChilli is an open source access controller for wireless LAN
            access points and is based on ChilliSpot. It is used for authenticating
            users of a wireless (or wired) LAN. It supports web based login (UAM)
    -       which is today's standard for public HotSpots and it supports Wireless
    -       Protected Access (WPA) which is the standard of the future.
    -       Authentication, authorization and accounting (AAA) is handled by your
    -       favorite radius server.
    +       which is today's standard for public HotSpots and it supports Wireless Protected
    +       Access (WPA) which is the standard of the future. Authentication,
    +       authorization and accounting (AAA) is handled by your favorite
    +       radius server.
     endef
    
    -define Package/coova-chilli/conffiles
    -/etc/chilli.conf
    +define Build/Configure
    +  (cd $(PKG_BUILD_DIR); rm -rf config.{cache,status} ; \
    +               $(TARGET_CONFIGURE_OPTS) \
    +                CFLAGS="$(strip $(TARGET_CFLAGS)) -DNEED_DN_SKIPNAME" \
    +                CPPFLAGS="-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include" \
    +                LDFLAGS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib" \
    +               ac_cv_func_malloc_0_nonnull=yes \
    +               ac_cv_func_realloc_0_nonnull=yes \
    +               ac_cv_func_memcmp_working=yes \
    +               ac_cv_func_setvbuf_reversed=no \
    +                ./configure \
    +                       --target=$(GNU_TARGET_NAME) \
    +                       --host=$(GNU_TARGET_NAME) \
    +                       --build=$(GNU_HOST_NAME) \
    +                       --program-prefix="" \
    +                       --program-suffix="" \
    +                       --prefix=/usr \
    +                       --sysconfdir=/etc \
    +                       --exec-prefix=/usr \
    +                       --bindir=/usr/bin \
    +                       --datadir=/usr/share \
    +                       --includedir=/usr/include \
    +                       --infodir=/usr/share/info \
    +                       --libdir=/usr/lib \
    +                       --libexecdir=/usr/lib \
    +                       --localstatedir=/var \
    +                       --mandir=/usr/share/man \
    +                       --sbindir=/usr/sbin \
    +                       --enable-shared \
    +                       --disable-static \
    +                       --with-gnu-ld \
    +                       --enable-miniconfig \
    +                       --enable-miniportal \
    +                       --enable-chilliredir \
    +                       --enable-chilliproxy \
    +                       --enable-binstatusfile \
    +        );
     endef
    
    +define Build/Compile
    +       $(MAKE) -C $(PKG_BUILD_DIR) \
    +               DESTDIR="$(PKG_INSTALL_DIR)" \
    +               all install
    +endef
    +
    +define Build/InstallDev
    +       $(INSTALL_DIR) $(1)/usr/include
    +       $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
    +       $(INSTALL_DIR) $(1)/usr/lib
    +       $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib* $(1)/usr/lib/
    +endef
    +
    +
    +define Package/coova-chilli-miniportal/install
    +       $(INSTALL_DIR) $(1)/etc/chilli
    +       $(CP) $(PKG_INSTALL_DIR)/etc/chilli/www $(1)/etc/chilli/
    +endef
    +
     define Package/coova-chilli/install
    -       $(INSTALL_DIR) $(1)/etc
    -       $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/chilli.conf $(1)/etc/
    -       $(INSTALL_DIR) $(1)/etc/chilli
    -       $(CP) $(PKG_INSTALL_DIR)/etc/chilli/* $(1)/etc/chilli/
    +       $(INSTALL_DIR) $(1)/etc/chilli
    +       $(CP) $(PKG_INSTALL_DIR)/etc/chilli.conf $(1)/etc/
    +       $(CP) $(PKG_INSTALL_DIR)/etc/chilli/up.sh $(1)/etc/chilli/
    +       $(CP) $(PKG_INSTALL_DIR)/etc/chilli/down.sh $(1)/etc/chilli/
    +       $(CP) $(PKG_INSTALL_DIR)/etc/chilli/wwwsh $(1)/etc/chilli/
    +       $(INSTALL_DIR) $(1)/etc/init.d
    +       $(CP) files/chilli.init $(1)/etc/init.d/chilli
    +       $(INSTALL_DIR) $(1)/lib/firewall
    +       $(CP) files/chilli.firewall $(1)/lib/firewall/chilli.sh
            $(INSTALL_DIR) $(1)/usr/sbin
    -       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/chilli* $(1)/usr/sbin/
    +       $(CP) $(PKG_INSTALL_DIR)/usr/sbin/chilli* $(1)/usr/sbin/
            $(INSTALL_DIR) $(1)/usr/lib/
            $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib*.so.* $(1)/usr/lib/
     endef
    
     $(eval $(call BuildPackage,coova-chilli))
    +$(eval $(call BuildPackage,coova-chilli-miniportal))
    
    

    public by Geometry  975  0  4  0

    SilvermanRule: Gets the Silverman's rule. estimative of the smoothing parameter. This is the default smoothing rule applied used when estimating <see cref="MultivariateEmpiricalDistribution"/>s.

    Gets the Silverman's rule. estimative of the smoothing parameter. This is the default smoothing rule applied used when estimating s. This method is described on Wikipedia, at http://en.wikipedia.org/wiki/Multivariate_kernel_density_estimation The observations for the empirical distribution. The fractional importance for e
    /// <summary>
    ///   Gets the Silverman's rule. estimative of the smoothing parameter.
    ///   This is the default smoothing rule applied used when estimating 
    ///   <see cref="MultivariateEmpiricalDistribution"/>s.
    /// </summary>
    /// 
    /// <remarks>
    ///   This method is described on Wikipedia, at
    ///   http://en.wikipedia.org/wiki/Multivariate_kernel_density_estimation
    /// </remarks>
    /// 
    /// <param name="observations">The observations for the empirical distribution.</param>
    /// <param name="weights">The fractional importance for each sample. Those values must sum up to one.</param>
    /// <param name="repeats">The number of times each sample should be repeated.</param>
    /// 
    /// <returns>An estimative of the smoothing parameter.</returns>
    /// 
    public static double[,] SilvermanRule(double[][] observations, double[] weights, int[] repeats)
    {
        if (weights != null)
            return SilvermanRule(observations, weights);
    
        if (repeats != null)
            return SilvermanRule(observations, repeats);
    
        return SilvermanRule(observations);
    }

    public by micurs  1979  2  7  2

    CSS rule to remove dotted outline links

    This CSS rule removes dotted outline around links.
    a {
       outline: 0;
    }

    public by yoonlee  1760  3  6  0

    [CodingRule] HMS01

    HMS 프로젝트 코딩 룰 01
    public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }
    
            protected override void OnLoad(EventArgs e)
            {
                // 00 Inlitialize는 OnLoad 함수에서 처리
                base.OnLoad(e);
    
                try
                {
                    //00. Event 등록 전, 컨트롤 초기화
                    InitializeControl();
    
                    //00. Evnet 등록은 코드로 처리
                    InitializeEvent();
    
                    //01. if문 조건문에 ! 대신에 false로 처리하기
                    //02. 비교대상 문자열을 앞에 위치, Equals  함수 사용하기
                    CodingRule1();
    
                    //03. loop문 사용시 조건 확장메서드 사용하기
                    CodingRule2();
    
                    //04. validation 처리
                    CodingRule3(new DataTable());
                }
                catch (Exception)
                {
                    throw;
                }
            }
    
            #region Initialize
            private void InitializeControl()
            {
                try
                {
    
                }
                catch (Exception)
                {
    
                    throw;
                }
            }
    
            private void InitializeEvent()
            {
                try
                {
                    this.DoubleClick += new EventHandler(Form1_DoubleClick);
                    this.button1.Click += new EventHandler(button1_Click);
                }
                catch (Exception)
                {
    
                    throw;
                }
            }
    
            #endregion
    
            #region Event
    
            void Form1_DoubleClick(object sender, EventArgs e)
            {
                //01. Depth Level이 0인 함수는 꼭 Try Catch 문 처리할 것 
                try
                {
                    testc();
                }
                catch (Exception)
                {
                    
                    throw;
                }
            }
    
            private void testc()
            {
                //DETPTH 1
    
            }
    
            void button1_Click(object sender, EventArgs e)
            {
                try
                {
                     //01. sender를 형 변환해서 사용해야 재샤용성이 높아짐
                    if (sender is Button)
                    {
                        //02. as 로 캐스팅할 경우 캐스팅 실패시 null을 리턴함
                        //(Button) 식으로 캐스팅 할 경우 실패시 Exception 발생
                        Button btn = sender as Button;
    
                        string str = btn.Name;
                    }
                }
                catch (Exception)
                {
                    
                    throw;
                }
            }
    
            #endregion
    
            #region Method
            private void CodingRule1()
            {
                string tempStr = null;
    
                //tempStr의 값이 null일 경우에 false 값을 리턴함
                //tempStr.Equals("Y") 처리했을 경우 Exceptiono 발생
                if ("Y".Equals(tempStr) == false)
                {
                    
                }
            }
    
    
            private void CodingRule2()
            {
                DataTable dt = new DataTable();
    
                //불필요한 loop  제거
                //람다식을 사용할 경우 디버그 모드에서 문제가 수정이 불하가하니 Select 함수 권장
                foreach (DataRow row in dt.Select("ISUSABLE = 'Usable'"))
                {
                    
                }
            }
    
    
            private void CodingRule3(DataTable dataTable)
            {
                // 분기문으로 Validation 처리하는 경우 조건을 부정문으로 작성하여 
                // 괄호로 감싸지 말고 Line 한줄로 처리할 것 (중복된 괄호처리로 인해 가독성이 낮아지는 현상 방지)
                if (dataTable == null || dataTable.Rows.Count <= 0) return;
            }
    
            #endregion
    
        }

    public by Geometry  1030  1  6  0

    Integrate: Computes the area under the integral for the given function, in the given integration interval, using the Trapezoidal rule.

    Computes the area under the integral for the given function, in the given integration interval, using the Trapezoidal rule. The number of steps into which the integration interval will be divided. The unidimensional function whose integral should be computed. The beginning of the integration interval. The ending of the integration inte
    /// <summary>
    ///   Computes the area under the integral for the given function, 
    ///   in the given integration interval, using the Trapezoidal rule.
    /// </summary>
    /// 
    /// <param name="steps">The number of steps into which the integration interval will be divided.</param>
    /// <param name="func">The unidimensional function whose integral should be computed.</param>
    /// <param name="a">The beginning of the integration interval.</param>
    /// <param name="b">The ending of the integration interval.</param>
    /// 
    /// <returns>The integral's value in the current interval.</returns>
    /// 
    public static double Integrate(Func<double, double> func, double a, double b, int steps)
    {
        double h = (b - a) / steps;
    
        double sum = 0.5 * (func(a) + func(b));
    
        for (int i = 1; i < steps; i++)
            sum += func(a + i * h);
    
        return h * sum;
    }

    public by jaehoon  3491  0  4  0

    modified version of coova-chilli patch for OpenWrt. This patch re-add firewall rules when reload firewall. https://lists.openwrt.org/pipermail/openwrt-devel/2012-December/018075.html

    modified version of coova-chilli patch for OpenWrt. This patch re-add firewall rules when reload firewall. https://lists.openwrt.org/pipermail/openwrt-devel/2012-December/018075.html: coova-1.3.0-custom.patch
    Index: files/chilli.init
    ===================================================================
    --- files/chilli.init   (리비전 0)
    +++ files/chilli.init   (리비전 0)
    @@ -0,0 +1,61 @@
    +#!/bin/sh /etc/rc.common
    +
    +START=30
    +STOP=90
    +
    +config_cb() {
    +    chilli_inst=$2
    +    if [ "$chilli_inst" != "" ]
    +    then
    +       rm -f /var/run/chilli_${chilli_inst}*
    +       chilli_conf=/var/run/chilli_${chilli_inst}.conf
    +       eval "start_chilli_$chilli_inst=1"
    +    fi
    +}
    +
    +option_cb() {
    +    case "$1" in
    +        # UCI settings
    +       network)
    +           . /lib/functions/network.sh
    +           local ifname
    +           network_get_device ifname $2
    +           echo "dhcpif=\"$ifname\"" >> $chilli_conf
    +           ;;
    +       disabled)
    +           eval "start_chilli_$chilli_inst=0"
    +           ;;
    +        # boolean settings
    +       dhcpbroadcast|nodynip|vlanlocation|locationstopstart|locationcopycalled|locationimmediateupdate|locationopt82|coanoipcheck|noradallow|proxymacaccept|proxyonacct|dhcpmacset|dhcpradius|noc2c|eapolenable|uamanydns|uamanyip|uamnatanyip|nouamsuccess|nowispr1|nowispr2|domaindnslocal|radsec|macauth|macreauth|macauthdeny|macallowlocal|strictmacauth|strictdhcp|ieee8021q|only8021q|radiusoriginalurl|swapoctets|statusfilesave|wpaguests|openidauth|papalwaysok|mschapv2|chillixml|acctupdate|dnsparanoia|seskeepalive|usetap|noarpentries|framedservice|scalewin|redir|injectwispr|redirurl|routeonetone|nousergardendata|uamgardendata|uamotherdata|withunixipc|uamallowpost|redirssl|uamuissl|layer3|patricia|redirdnsreq|dhcpnotidle|ipv6|ipv6only)
    +           [ "$2" = "true" -o "$2" = "1" ] && echo "$1" >> $chilli_conf
    +           ;;
    +       *)
    +           echo "$1=\"$2\"" >> $chilli_conf
    +           ;;
    +    esac
    +}
    +
    +start_chilli() {
    +    local cfg="$1"
    +    local start_chilli=$(eval "echo \$start_chilli_$cfg")
    +    [ "$start_chilli" = "0" ] && return
    +    local base=/var/run/chilli_${cfg}
    +    chilli -c ${base}.conf \
    +       --pidfile ${base}.pid \
    +       --cmdsocket ${base}.sock \
    +       --unixipc ${base}.ipc &
    +}
    +
    +start() {
    +    config_load chilli
    +    config_foreach start_chilli chilli
    +}
    +
    +stop() {
    +    ls /var/run/chilli*.pid 2>/dev/null && {
    +       kill $(cat /var/run/chilli*.pid)
    +       sleep 1
    +       killall -9 chilli &
    +       rm -f /var/run/chilli*
    +    }
    +}
    Index: files/chilli.firewall
    ===================================================================
    --- files/chilli.firewall       (리비전 0)
    +++ files/chilli.firewall       (리비전 0)
    @@ -0,0 +1,33 @@
    +#!/bin/sh
    +
    +chilli_firewall() {
    +    local cfg="$1"
    +    local tun ipup addr mask net dhcpif uamport uamuiport
    +
    +    config_get tun "$cfg" tundev
    +    config_get ipup "$cfg" ipup
    +    config_get addr "$cfg" uamlisten
    +    config_get net "$cfg" net
    +    config_get dhcpif "$cfg" dhcpif
    +    config_get uamport "$cfg" uamport
    +    config_get uamuiport "$cfg" uamuiport
    +
    +    if [ -f /var/run/chilli.$tun.sh ]; then
    +        [ "$(iptables -t filter -vL | grep $tun)" != "" ] && . /var/run/chilli.$tun.sh
    +        DEV=$tun
    +        ADDR=$addr
    +        MASK=255.255.255.0
    +        NET=$net
    +        DHCPIF=$dhcpif
    +        UAMPORT=$uamport
    +        UAMUIPORT=$uamuiport
    +        . $ipup
    +    fi
    +
    +}
    +
    +chilli_post_core_cb() {
    +    config_load chilli
    +    config_foreach chilli_firewall chilli
    +}
    +
    Index: Makefile
    ===================================================================
    --- Makefile    (리비전 37020)
    +++ Makefile    (작업 사본)
    @@ -8,16 +8,13 @@
     include $(TOPDIR)/rules.mk
    
     PKG_NAME:=coova-chilli
    -PKG_VERSION:=1.2.9
    +PKG_VERSION:=1.3.0
     PKG_RELEASE:=1
    
     PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
    -PKG_SOURCE_URL:=http://ap.coova.org/chilli
    -PKG_MD5SUM:=a493d0562fc3b05fe86d8ad65f7f2dc0
    +PKG_SOURCE_URL:=http://coova-chilli.s3.amazonaws.com/
    +PKG_MD5SUM:=dc0037e3cdebcb60508081b4e42e984a
    
    -PKG_FIXUP:=autoreconf
    -PKG_INSTALL:=1
    -
     include $(INCLUDE_DIR)/package.mk
    
     define Package/coova-chilli
    @@ -25,33 +22,102 @@
       SECTION:=net
       CATEGORY:=Network
       DEPENDS:=+kmod-tun +librt
    -  TITLE:=Wireless LAN HotSpot controller (Coova Chilli Version)
    -  URL:=http://www.coova.org/CoovaChilli
    +  TITLE:=Wireless LAN HotSpot controller
    +  URL:=http://www.coova.org/
     endef
    
    +define Package/coova-chilli-miniportal
    +  SUBMENU:=Captive Portals
    +  SECTION:=net
    +  CATEGORY:=Network
    +  DEPENDS:=+coova-chilli
    +  TITLE:=CoovaChilli MiniPortal
    +  URL:=http://www.coova.org/
    +endef
    +
     define Package/coova-chilli/description
            CoovaChilli is an open source access controller for wireless LAN
            access points and is based on ChilliSpot. It is used for authenticating
            users of a wireless (or wired) LAN. It supports web based login (UAM)
    -       which is today's standard for public HotSpots and it supports Wireless
    -       Protected Access (WPA) which is the standard of the future.
    -       Authentication, authorization and accounting (AAA) is handled by your
    -       favorite radius server.
    +       which is today's standard for public HotSpots and it supports Wireless Protected
    +       Access (WPA) which is the standard of the future. Authentication,
    +       authorization and accounting (AAA) is handled by your favorite
    +       radius server.
     endef
    
    -define Package/coova-chilli/conffiles
    -/etc/chilli.conf
    +define Build/Configure
    +  (cd $(PKG_BUILD_DIR); rm -rf config.{cache,status} ; \
    +               $(TARGET_CONFIGURE_OPTS) \
    +                CFLAGS="$(strip $(TARGET_CFLAGS)) -DNEED_DN_SKIPNAME" \
    +                CPPFLAGS="-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include" \
    +                LDFLAGS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib" \
    +               ac_cv_func_malloc_0_nonnull=yes \
    +               ac_cv_func_realloc_0_nonnull=yes \
    +               ac_cv_func_memcmp_working=yes \
    +               ac_cv_func_setvbuf_reversed=no \
    +                ./configure \
    +                       --target=$(GNU_TARGET_NAME) \
    +                       --host=$(GNU_TARGET_NAME) \
    +                       --build=$(GNU_HOST_NAME) \
    +                       --program-prefix="" \
    +                       --program-suffix="" \
    +                       --prefix=/usr \
    +                       --sysconfdir=/etc \
    +                       --exec-prefix=/usr \
    +                       --bindir=/usr/bin \
    +                       --datadir=/usr/share \
    +                       --includedir=/usr/include \
    +                       --infodir=/usr/share/info \
    +                       --libdir=/usr/lib \
    +                       --libexecdir=/usr/lib \
    +                       --localstatedir=/var \
    +                       --mandir=/usr/share/man \
    +                       --sbindir=/usr/sbin \
    +                       --enable-shared \
    +                       --disable-static \
    +                       --with-gnu-ld \
    +                       --enable-miniconfig \
    +                       --enable-miniportal \
    +                       --enable-chilliredir \
    +                       --enable-chilliproxy \
    +                       --enable-binstatusfile \
    +        );
     endef
    
    +define Build/Compile
    +       $(MAKE) -C $(PKG_BUILD_DIR) \
    +               DESTDIR="$(PKG_INSTALL_DIR)" \
    +               all install
    +endef
    +
    +define Build/InstallDev
    +       $(INSTALL_DIR) $(1)/usr/include
    +       $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
    +       $(INSTALL_DIR) $(1)/usr/lib
    +       $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib* $(1)/usr/lib/
    +endef
    +
    +
    +define Package/coova-chilli-miniportal/install
    +       $(INSTALL_DIR) $(1)/etc/chilli
    +       $(CP) $(PKG_INSTALL_DIR)/etc/chilli/www $(1)/etc/chilli/
    +endef
    +
     define Package/coova-chilli/install
    -       $(INSTALL_DIR) $(1)/etc
    -       $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/chilli.conf $(1)/etc/
    -       $(INSTALL_DIR) $(1)/etc/chilli
    -       $(CP) $(PKG_INSTALL_DIR)/etc/chilli/* $(1)/etc/chilli/
    +       $(INSTALL_DIR) $(1)/etc/chilli
    +       $(CP) $(PKG_INSTALL_DIR)/etc/chilli.conf $(1)/etc/
    +       $(CP) $(PKG_INSTALL_DIR)/etc/chilli/up.sh $(1)/etc/chilli/
    +       $(CP) $(PKG_INSTALL_DIR)/etc/chilli/down.sh $(1)/etc/chilli/
    +       $(CP) $(PKG_INSTALL_DIR)/etc/chilli/wwwsh $(1)/etc/chilli/
    +       $(INSTALL_DIR) $(1)/etc/init.d
    +       $(CP) files/chilli.init $(1)/etc/init.d/chilli
    +       $(INSTALL_DIR) $(1)/lib/firewall
    +       $(CP) files/chilli.firewall $(1)/lib/firewall/chilli.sh
            $(INSTALL_DIR) $(1)/usr/sbin
    -       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/chilli* $(1)/usr/sbin/
    +       $(CP) $(PKG_INSTALL_DIR)/usr/sbin/chilli* $(1)/usr/sbin/
            $(INSTALL_DIR) $(1)/usr/lib/
            $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib*.so.* $(1)/usr/lib/
     endef
    
     $(eval $(call BuildPackage,coova-chilli))
    +$(eval $(call BuildPackage,coova-chilli-miniportal))
    
    

    public by arkanoid  18024  0  6  2

    HTML - Removing the outline on an input field

    The annoying blue border outlining the input field in focus can be removed with a simple CSS rule
    input[type=text]:focus{
        outline: 0;
    }
    

    public by cghersi  2628  4  5  1

    Send an update onto Twitter with Twitter API

    Programmatically twitts the given content using the specified credentials. According to the Twitter rules, the same content cannot be sent twice.
    public static bool SendTwitterUpdate(string update, string consumerKey, string consumerSecret, 
      string accessToken, string accessTokenSecret)
    {
      string url = "https://api.twitter.com/1.1/statuses/update.json";
      string newStatus = Uri.EscapeDataString(update);
    
      string nonce = GetNonce();
      string timestamp = UnixTimeNow().ToString();
    
      //compute the signature:
      string stringForSignature = string.Format("POST&{5}&oauth_consumer_key%3D{0}%26oauth_nonce%3D{1}%26" +
        "oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D{2}%26oauth_token%3D{3}%26oauth_version%3D1.0%26status%3D{4}",
        consumerKey, nonce, timestamp, accessToken, Uri.EscapeDataString(newStatus), Uri.EscapeDataString(url));
      string signingKey = string.Format("{0}&{1}", Uri.EscapeDataString(consumerSecret), Uri.EscapeDataString(accessTokenSecret));
      string signature = HmacSha1(signingKey, stringForSignature);
    
      Dictionary<string, string> headers = new Dictionary<string, string>();
      headers.Add("Authorization", string.Format("OAuth oauth_consumer_key=\"{0}\", oauth_nonce=\"{1}\", " +
        "oauth_signature=\"{2}\", oauth_signature_method=\"HMAC-SHA1\", oauth_timestamp=\"{3}\", " +
        "oauth_token=\"{4}\", oauth_version=\"1.0\"",
        consumerKey, nonce, Uri.EscapeDataString(signature), timestamp, accessToken));
    
      string resp = SendRequest(url + "?status=" + newStatus, "", true, headers);
      return !string.IsNullOrEmpty(resp);
    }
    
    private static string HmacSha1(string secretKey, string signatureString)
    {
      var enc = System.Text.Encoding.UTF8;
      var hmac = new System.Security.Cryptography.HMACSHA1(enc.GetBytes(secretKey));
      byte[] signatureBytes = hmac.ComputeHash(enc.GetBytes(signatureString));
      return Convert.ToBase64String(signatureBytes);
    }
    
    //Snippet da Snip2Code => C#: retrieve the number of seconds from Epoch
    private static long UnixTimeNow()
    {
      TimeSpan timeSpan = (DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0));
      return (long)timeSpan.TotalSeconds;
    }
    
    private static string GetNonce()
    {
      byte[] bytes = new byte[32];
      new Random().NextBytes(bytes);
      string base64 = Convert.ToBase64String(bytes);
      return System.Text.RegularExpressions.Regex.Replace(base64, "[^A-Za-z]", "");
    }
    
    
    private static string SendRequest(string serviceUrl, string data, bool isPost, Dictionary<string, string> headers)
    {
      HttpWebRequest webRequest = null;
      try
      {
        webRequest = WebRequest.Create(serviceUrl) as HttpWebRequest;
      }
      catch (UriFormatException ufe)
      {
        Console.WriteLine("Cannot connect to {0} due to {1} ", serviceUrl, ufe.Message);
        return string.Empty;
      }
    
      if (isPost)
      {
        webRequest.Method = "POST";
        webRequest.ContentType = "application/x-www-form-urlencoded";
      }
    
      if (headers != null)
      {
        foreach (string key in headers.Keys)
        {
          webRequest.Headers.Add(key, headers[key]);
        }
      }
    
      if (isPost && (data != null))
        webRequest.ContentLength = data.Length;
    
      StreamReader responseReader = null;
      string responseData = string.Empty;
      WebResponse webResp = null;
      try
      {
        if (isPost)
        {
          // write the form values into the request message
          StreamWriter requestWriter = new StreamWriter(webRequest.GetRequestStream());
          requestWriter.Write(data);
          requestWriter.Flush();
          requestWriter.Close();
          requestWriter.Dispose();
        }
    
        webResp = webRequest.GetResponse();
        Stream webStream = webResp.GetResponseStream();
        responseReader = new StreamReader(webStream);
    
        //read the response:
        responseData = responseReader.ReadToEnd();
      }
      catch (WebException wex)
      {
        return string.Empty;
      }
      catch (IOException ioex)
      {
        return string.Empty;
      }
      finally
      {
        if (responseReader != null)
        {
          responseReader.Close();
          responseReader.Dispose();
        }
        if (webResp != null)
          webResp.Close();
        webRequest = null;
      }
    
      return responseData;
    }
    

    public by Geometry  991  0  5  0

    FromSlopeIntercept: Creates a <see cref="Line"/> with the specified slope and intercept.

    Creates a with the specified slope and intercept. The slope of the line The Y-intercept of the line, unless the slope is an infinity, in which case the line's equation is "x = intercept" instead. Returns a representing the specified line. The construction here follows the same rules as for the rest of this class. Most lines are e
    /// <summary>
    /// Creates a <see cref="Line"/> with the specified slope and intercept.
    /// </summary>
    /// 
    /// <param name="slope">The slope of the line</param>
    /// <param name="intercept">The Y-intercept of the line, unless the slope is an
    /// infinity, in which case the line's equation is "x = intercept" instead.</param>
    /// 
    /// <returns>Returns a <see cref="Line"/> representing the specified line.</returns>
    /// 
    /// <remarks><para>The construction here follows the same rules as for the rest of this class.
    /// Most lines are expressed as y = slope * x + intercept. Vertical lines, however, are 
    /// x = intercept. This is indicated by <see cref="IsVertical"/> being true or by 
    /// <see cref="Slope"/> returning <see cref="float.PositiveInfinity"/> or 
    /// <see cref="float.NegativeInfinity"/>.</para></remarks>
    /// 
    public static Line FromSlopeIntercept(float slope, float intercept)
    {
        return new Line(slope, intercept);
    }

    public by JKCPR  2316  3  7  3

    Shutdown Windows

    Automate the shutdown of your machine using this snippet and an Outlook rule to initiate it
    c:\windows\system32\shutdown -s -f -t 00
    
    
    • Public Snippets
    • Channels Snippets