working on it ...

Filters

Explore Public Snippets

Sort by

Found 5,374 snippets matching: settings

    public by elenka  237504  4  7  0

    add WooCommerce settins tab

    <?php
    
    if ( !class_exists('Woo_Settings ') ):
    
    /**
     * 
     * @version 1.0
     * @access public
     */
    class Woo_Settings {
    
      public static function init() {
        add_filter( 'woocommerce_settings_tabs_array', __CLASS__ . '::add_settings_tab', 70);
        add_action( 'woocommerce_settings_tabs_settings_orders_page', __CLASS__ . '::settings_tab' );
      }
    
      /**
      * Add a new settings tab to the WooCommerce settings tabs array.
      */
      public static function add_settings_tab( $settings_tabs ) {
        $settings_tabs['settings_orders_page'] = __( 'Orders Page', 'linen' );
        return $settings_tabs;
      }
      /**
      * Uses the WooCommerce admin fields API to output settings via the @see woocommerce_admin_fields() function.
      *
      * @uses woocommerce_admin_fields()
      * @uses self::get_settings()
      */
      public static function settings_tab() {
        woocommerce_admin_fields( self::get_settings() );
      }
    
      /**
      * Get all the settings for this plugin for @see woocommerce_admin_fields() function.
      *
      * @return array Array of settings for @see woocommerce_admin_fields() function.
      */
      public static function get_settings() {
    
        $settings[] = array( 'title' => __( 'Orders Page', 'linen' ), 'type' => 'title', 'desc' => '', 'id' => 'wc_order_customiser_orders_page' );
        $settings[] = array(
          'title'    => __( 'Table Type', 'linen' ),
          'id'       => 'wc_order_customiser_table_type',
          'default'  => 'static',
          'type'     => 'radio',
          'options'  => array(
            'static'  => __( 'Static', 'linen' ),
            'dynamic' => __( 'Dynamic', 'linen' ),
          ),
          'autoload' => true
        );
        $settings[] = array( 'type' => 'sectionend', 'id' => 'wc_order_customiser_orders_page' );
    
        $settings[] = array( 'title' => __( 'Position & Size', 'linen' ), 'type' => 'title', 'desc' => '', 'id' => 'wc_order_customiser_position_n_size' );
        $settings[] = array(
          'title'    => __( 'Table Type', 'linen' ),
          'id'       => 'wc_order_customiser_table_type',
          'default'  => 'static',
          'type'     => 'radio',
          'options'  => array(
            'static'  => __( 'Static', 'linen' ),
            'dynamic' => __( 'Dynamic', 'linen' ),
          ),
          'autoload' => true
        );
        $settings[] = array( 'type' => 'sectionend', 'id' => 'wc_order_customiser_position_n_size' );
    
        return apply_filters( 'wc_settings_tab_orders_page', $settings );
      }
    
      /**
      * Uses the WooCommerce options API to save settings via the @see woocommerce_update_options() function.
      *
      * @uses woocommerce_update_options()
      * @uses self::get_settings()
      */
      public static function update_settings() {
        woocommerce_update_options( self::get_settings() );
      }
    
    	
    }
    Woo_Settings::init();
    endif;
    ?>                        

    public by cghersi  3020  0  6  0

    How to create a DefaultHttpClient with proxy settings

    This is how to create a DefaultHttpClient adding information regarding the proxy the client is using
    private static DefaultHttpClient createHttpClient() {
    	DefaultHttpClient httpClient = new DefaultHttpClient();
    	if (!Utils.isNullOrEmpty(proxyAddress) && (proxyPort > 0)) {
    		HttpHost httpproxy = new HttpHost(proxyAddress, proxyPort);
    		httpClient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, httpproxy);
    	}
    	return httpClient;
    }

    public by cghersi  2635  1  7  0

    How to retrieve proxy settings within Eclipse

    This class helps to retrieve the proxy settings stored in the preferences of Eclipse. It automatically retrieves such settings using an IProxyService instance provided by the Eclipse RCP platform.
    public class ProxyManager {
    	
    	private final static ServiceTracker<IProxyService, IProxyService> proxyTracker;
    	protected static Logger log = Logger.getLogger(ProxyManager.class);
    	
    	static {
    		proxyTracker = new ServiceTracker<IProxyService, IProxyService>(FrameworkUtil.getBundle(ProxyManager.class).getBundleContext(), 
    				IProxyService.class.getName(), null);
            proxyTracker.open();
    	}
    	
    	private static IProxyService getProxyService() {
            return proxyTracker.getService();
        }
    	
    	public static void setProxy() {
    		IProxyService proxyService = getProxyService();
            IProxyData[] proxyDataForHost = null;
    		try {
    			proxyDataForHost = proxyService.select(new URI(AppConfig.get().getSiteBasePath()));
    		} catch (URISyntaxException e) {
    			log.error("CAnnot find url for proxy service due to " + e, e);
    			return;
    		}
    
    		if (proxyDataForHost != null) {
    	        for (IProxyData data : proxyDataForHost) {
    	            if (data.getHost() != null) {
    	                WebConnector.setProxySettings(data.getHost(), data.getPort());
    	            }
    	        }
    		}
    		
            // Close the service and close the service tracker
            proxyService = null;
    	}
    }

    public by micheleaiello  2745  0  5  0

    Open Settings (iOS 8 or above)

    BOOL canOpenSettings = (&UIApplicationOpenSettingsURLString != NULL);
    if (canOpenSettings) {
      NSURL *settingsURL = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
      [[UIApplication sharedApplication] openURL:settingsURL];
    }

    public by BrentHoover  1971  0  4  0

    Calling context manager that changes settings while running tests

    Calling context manager that changes settings while running tests: test_settings_context.py
    with self.settings(LOGIN_URL='/other/login/'):
    
    

    public by Aysad Kozanoglu  1304  1  4  0

    fail2ban jail settings for nginx 400 444 403 404 filtering on http https

    fail2ban jail settings for nginx 400 444 403 404 filtering on http https: fail2ban_jail.conf
    #nano /etc/fail2ban/jail.conf
    #
    [nginx-4xx]
    enabled  = true
    port     = http,https
    filter   = nginx-4xx
    logpath  = /usr/local/nginx/logs/access.log
    maxretry = 4
    
    
    

    public by Aysad Kozanoglu  1045  0  4  0

    postfix mail version = 2.9.6 main.cf settings - worked

    postfix mail version = 2.9.6 main.cf settings - worked : postfix_main.cf
    # See /usr/share/postfix/main.cf.dist for a commented, more complete version
    
    
    # Debian specific:  Specifying a file name will cause the first
    # line of that file to be used as the name.  The Debian default
    # is /etc/mailname.
    #myorigin = /etc/mailname
    
    smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
    biff = no
    
    # appending .domain is the MUA's job.
    append_dot_mydomain = no
    
    # Uncomment the next line to generate "delayed mail" warnings
    #delay_warning_time = 4h
    
    readme_directory = no
    
    # TLS parameters
    smtpd_tls_cert_file = /etc/postfix/sslcert/server.crt
    smtpd_tls_key_file = /etc/postfix/sslcert/server.key
    smtpd_use_tls=yes
    smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
    smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
    
    # See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
    # information on enabling SSL in the smtp client.
    
    myhostname = mail.playandsurf.com
    alias_maps = hash:/etc/aliases
    alias_database = hash:/etc/aliases
    myorigin = /etc/mailname
    mydestination = mail.playandsurf.com, localhost.playandsurf.com, , localhost
    relayhost = 
    mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
    mailbox_size_limit = 0
    recipient_delimiter = +
    inet_interfaces = all
    
    
    # a bit more spam protection
    disable_vrfy_command = yes
     
    # Authentification
    smtpd_sasl_type=dovecot
    smtpd_sasl_path=private/auth_dovecot
    smtpd_sasl_auth_enable = yes
    smtpd_sasl_authenticated_header = yes
    broken_sasl_auth_clients = yes
     
    proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $smtpd_sender_login_maps
     
    smtpd_sender_login_maps = proxy:mysql:/etc/postfix/mysql_sender_login_maps.cf
     
    smtpd_sender_restrictions = reject_authenticated_sender_login_mismatch
            reject_unknown_sender_domain
     
    smtpd_recipient_restrictions = permit_sasl_authenticated
            permit_mynetworks
       	reject_invalid_hostname,
       	reject_non_fqdn_hostname,
       	reject_non_fqdn_sender,
       	reject_non_fqdn_recipient,
       	reject_unknown_sender_domain,
       	reject_unknown_recipient_domain,
       	reject_unauth_destination,
    #   	reject_rbl_client list.dsbl.org,
    #   	reject_rbl_client sbl-xbl.spamhaus.org,
    #   	reject_rbl_client cbl.abuseat.org,
    #   	reject_rbl_client dul.dnsbl.sorbs.net,
            reject_rbl_client zen.spamhaus.org,
            reject_rbl_client list.dsbl.org,
       	permit
     
    # Mailboxen
    virtual_alias_maps = proxy:mysql:/etc/postfix/mysql_virtual_alias_maps.cf
    virtual_mailbox_base = /var/vmail/
    virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql_virtual_domains_maps.cf
    virtual_mailbox_limit = 124000000
    virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
    virtual_minimum_uid = 104
    virtual_transport = virtual
    virtual_uid_maps = static:5000
    virtual_gid_maps = static:5000
    virtual_transport = dovecot
    dovecot_destination_recipient_limit = 1
    
    
    

    public by Aysad Kozanoglu  1009  0  4  0

    postfix mail version 2.9.6 master.cf settings worked (wheezy)

    postfix mail version 2.9.6 master.cf settings worked (wheezy): postfix_master.cf
    #
    # Postfix master process configuration file.  For details on the format
    # of the file, see the master(5) manual page (command: "man 5 master").
    #
    # Do not forget to execute "postfix reload" after editing this file.
    #
    # ==========================================================================
    # service type  private unpriv  chroot  wakeup  maxproc command + args
    #               (yes)   (yes)   (yes)   (never) (100)
    # ==========================================================================
    smtp      inet  n       -       -       -       -       smtpd -v
    #smtp      inet  n       -       -       -       1       postscreen
    #smtpd     pass  -       -       -       -       -       smtpd
    #dnsblog   unix  -       -       -       -       0       dnsblog
    #tlsproxy  unix  -       -       -       -       0       tlsproxy
    #submission inet n       -       -       -       -       smtpd
    #  -o syslog_name=postfix/submission
    #  -o smtpd_tls_security_level=encrypt
    #  -o smtpd_sasl_auth_enable=yes
    #  -o smtpd_client_restrictions=permit_sasl_authenticated,reject
    #  -o milter_macro_daemon_name=ORIGINATING
    #smtps     inet  n       -       -       -       -       smtpd
    smtps     inet  n       -       -       -       -       smtpd
      -o smtpd_tls_wrappermode=yes
    #  -o syslog_name=postfix/smtps
    #  -o smtpd_tls_wrappermode=yes
    #  -o smtpd_sasl_auth_enable=yes
    #  -o smtpd_client_restrictions=permit_sasl_authenticated,reject
    #  -o milter_macro_daemon_name=ORIGINATING
    #628       inet  n       -       -       -       -       qmqpd
    pickup    fifo  n       -       -       60      1       pickup
    cleanup   unix  n       -       -       -       0       cleanup
    qmgr      fifo  n       -       n       300     1       qmgr
    #qmgr     fifo  n       -       n       300     1       oqmgr
    tlsmgr    unix  -       -       -       1000?   1       tlsmgr
    rewrite   unix  -       -       -       -       -       trivial-rewrite
    bounce    unix  -       -       -       -       0       bounce
    defer     unix  -       -       -       -       0       bounce
    trace     unix  -       -       -       -       0       bounce
    verify    unix  -       -       -       -       1       verify
    flush     unix  n       -       -       1000?   0       flush
    proxymap  unix  -       -       n       -       -       proxymap
    proxywrite unix -       -       n       -       1       proxymap
    smtp      unix  -       -       -       -       -       smtp
    relay     unix  -       -       -       -       -       smtp
    #       -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
    showq     unix  n       -       -       -       -       showq
    error     unix  -       -       -       -       -       error
    retry     unix  -       -       -       -       -       error
    discard   unix  -       -       -       -       -       discard
    local     unix  -       n       n       -       -       local
    virtual   unix  -       n       n       -       -       virtual
    lmtp      unix  -       -       -       -       -       lmtp
    anvil     unix  -       -       -       -       1       anvil
    scache    unix  -       -       -       -       1       scache
    #
    # ====================================================================
    # Interfaces to non-Postfix software. Be sure to examine the manual
    # pages of the non-Postfix software to find out what options it wants.
    #
    # Many of the following services use the Postfix pipe(8) delivery
    # agent.  See the pipe(8) man page for information about ${recipient}
    # and other message envelope options.
    # ====================================================================
    #
    # maildrop. See the Postfix MAILDROP_README file for details.
    # Also specify in main.cf: maildrop_destination_recipient_limit=1
    #
    maildrop  unix  -       n       n       -       -       pipe
      flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
    #
    # ====================================================================
    #
    # Recent Cyrus versions can use the existing "lmtp" master.cf entry.
    #
    # Specify in cyrus.conf:
    #   lmtp    cmd="lmtpd -a" listen="localhost:lmtp" proto=tcp4
    #
    # Specify in main.cf one or more of the following:
    #  mailbox_transport = lmtp:inet:localhost
    #  virtual_transport = lmtp:inet:localhost
    #
    # ====================================================================
    #
    # Cyrus 2.1.5 (Amos Gouaux)
    # Also specify in main.cf: cyrus_destination_recipient_limit=1
    #
    #cyrus     unix  -       n       n       -       -       pipe
    #  user=cyrus argv=/cyrus/bin/deliver -e -r ${sender} -m ${extension} ${user}
    #
    # ====================================================================
    # Old example of delivery via Cyrus.
    #
    #old-cyrus unix  -       n       n       -       -       pipe
    #  flags=R user=cyrus argv=/cyrus/bin/deliver -e -m ${extension} ${user}
    #
    # ====================================================================
    #
    # See the Postfix UUCP_README file for configuration details.
    #
    uucp      unix  -       n       n       -       -       pipe
      flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
    #
    # Other external delivery methods.
    #
    ifmail    unix  -       n       n       -       -       pipe
      flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
    bsmtp     unix  -       n       n       -       -       pipe
      flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient
    scalemail-backend unix	-	n	n	-	2	pipe
      flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}
    mailman   unix  -       n       n       -       -       pipe
      flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
      ${nexthop} ${user}
    dovecot   unix  -       n       n       -       -       pipe
      flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -d ${recipient}
    
    
    

    public by Teppei Sato  761  0  3  0

    Karabiner settings for Microsoft Remote Desktop

    Karabiner settings for Microsoft Remote Desktop: private.xml
    <?xml version="1.0"?>
    <root>
        <appdef>
            <appname>MicrosoftRDC</appname>
            <equal>com.microsoft.rdc.mac</equal>
        </appdef>
        <symbol_map type="KeyCode" name="RDC_VK_HOME" value="0x73"/>
        <symbol_map type="KeyCode" name="RDC_VK_END" value="0x77"/>
        <item>
            <name>Microsoft Remote Desktop App v8.0.14+</name>
            <!-- from http://fanblogs.jp/macyarounanoka/archive/134/0 -->
            <identifier>private.Microsoft_rdc_Custom</identifier>
            <!-- Microsoft Remote Desktopのみを対象にする -->
            <only>MicrosoftRDC</only>
            <!-- 英数キーをENDキーに置き換え -->
            <autogen>__KeyToKey__ KeyCode::JIS_EISUU, KeyCode::RDC_VK_END</autogen>
            <!-- カナキーをHOMEキーに置き換え -->
            <autogen>__KeyToKey__ KeyCode::JIS_KANA, KeyCode::RDC_VK_HOME</autogen>
            <!-- 右CommandキーをCtrlキーに置き換え -->
            <autogen>__KeyToKey__ KeyCode::COMMAND_R, KeyCode::CONTROL_R</autogen>
        </item>
    </root>
    
    

    public by Aysad Kozanoglu  735  0  3  0

    tmux very useful shortcuts settings

    tmux very useful shortcuts settings: tmux.conf
    # thanks goes to spicycode
    # https://gist.github.com/spicycode/1229612
    
    #  nano ~/.tmux.conf
    
    set -g base-index 1
    
    # Automatically set window title
    set-window-option -g automatic-rename on
    set-option -g set-titles on
    
    #set -g default-terminal screen-256color
    set -g status-keys vi
    set -g history-limit 10000
    
    setw -g mode-keys vi
    setw -g mode-mouse on
    setw -g monitor-activity on
    
    bind-key v split-window -h
    bind-key s split-window -v
    
    bind-key J resize-pane -D 5
    bind-key K resize-pane -U 5
    bind-key H resize-pane -L 5
    bind-key L resize-pane -R 5
    
    bind-key M-j resize-pane -D
    bind-key M-k resize-pane -U
    bind-key M-h resize-pane -L
    bind-key M-l resize-pane -R
    
    # Vim style pane selection
    bind h select-pane -L
    bind j select-pane -D 
    bind k select-pane -U
    bind l select-pane -R
    
    # Use Alt-vim keys without prefix key to switch panes
    bind -n M-h select-pane -L
    bind -n M-j select-pane -D 
    bind -n M-k select-pane -U
    bind -n M-l select-pane -R
    
    # Use Alt-arrow keys without prefix key to switch panes
    bind -n M-Left select-pane -L
    bind -n M-Right select-pane -R
    bind -n M-Up select-pane -U
    bind -n M-Down select-pane -D
    
    # Shift arrow to switch windows
    bind -n S-Left  previous-window
    bind -n S-Right next-window
    
    # No delay for escape key press
    set -sg escape-time 0
    
    # Reload tmux config
    bind r source-file ~/.tmux.conf
    
    # THEME
    set -g status-bg black
    set -g status-fg white
    set -g window-status-current-bg white
    set -g window-status-current-fg black
    set -g window-status-current-attr bold
    set -g status-interval 60
    set -g status-left-length 30
    set -g status-left '#[fg=green](#S) #(whoami)'
    set -g status-right '#[fg=yellow]#(cut -d " " -f 1-3 /proc/loadavg)#[default] #[fg=white]%H:%M#[default]'
    
    
    • Public Snippets
    • Channels Snippets