working on it ...

Filters

Explore Public Snippets

Sort by

Found 2.9M snippets

    public by Sweetysingh modified 10 hours ago  32  0  2  0

    Independent Escorts Services In Jaya Nagar

    // Enter here the actual content of the snippet.						

    public by bmooers modified yesterday at 10:10:31 PM  31  0  2  0

    roundview.py for PyMOL

    rounds off the viewport settings in PyMOL to 2 decimals places and returns on one line.
    // Enter here the actual content of the snippet.						
    
    from __future__ import division
    from __future__ import print_function
    # -*- coding: utf-8 -*-
    
    """
    version 1.0         26 October 2015
        Posted in github for first time.
    version 1.1         23 November 2015
        Corrected description of the rounding off the matrix elements.
        Corrected hard wrapped text the broke the script. 
        Added example of running program as a horizontal script.
        Made code pep8 compliant (changed use of blank lines, 
            removed whitespaces in defualt arguments assignments, 
            inserted whitespaces after commas in lists, 
            removed whitespaces at the ends of lines).
        Added version number.
    version 1.2         23 May 2016
        Edited copyright notice.
        Corrected typos
        
    version 1.3         23 July 2016
        Added missing parenthesis at end of file.
        
       Copyright Notice
      ================
      
         Copyright (C) 2016  Blaine Mooers
        This program is free software: you can redistribute it and/or modify
        it under the terms of the GNU General Public License as published by
        the Free Software Foundation, either version 3 of the License.
        This program is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
        See the GNU General Public License for more details:
        http://www.gnu.org/licenses/.
      The source code in this file is copyrighted, but you can
      freely use and copy it as long as you don't change or remove any of
      the copyright notices.
      
      Blaine Mooers, PhD 
      blaine-mooers@ouhsc.edu
      975 NE 10th St, BRC 466
      University of Oklahoma Health Sciences Center, 
      Oklahoma City, OK, USA 73104
     """
    from pymol import stored, cmd
    __author__ = "Blaine Mooers"
    __copyright__ = "Blaine Mooers, University of Oklahoma Health Sciences Center, Oklahoma City, OK, USA 73104"
    __license__ = "GPL-3"
    __version__ = "1.0.2"
    __credits__ = ["William Beasley","Chiedza Kanyumbu"] 
    # people who reported bug fixes, made suggestions, etc. 
    __date__ = "30 May 2016"
    __maintainer__ = "Blaine Mooers"
    __email__ = "blaine-mooers@ouhsc.edu"
    __status__ = "Production" 
    
    
    def roundview(StoredView=0, decimal_places=2, outname="roundedview.txt"):
    
        """
        DESCRIPTION
        Adds the command "roundview" that gets a view (default is 0,
        the current view; you can get a stored view assigned to some
        other digit with the view command) and rounds to two decimal
        places (two digits to the right of the decimal point) the
        viewpoint matrix elements and rewrites the matrix elements
        on a single line with no whitespaces and a semicolon at the
        end. The saved space eases the making of a single line of
        PyMOL commands separated by semicolons. This enables rapid
        and interactive editing of chunks of PyMOL commands. The
        viewpoints are appended to the bottom of a text file in the
        present working directory called "roundedview.txt". The line
        could be easier to copy from this file than from the command
        history window in the external gui. A semicolon with nothing
        to the right of it at the end of a line of grouped commands
        is harmless.
        USAGE
         
        roundview [view, decimal_places, outname] 
        Note that the values in the [] are optional.
        The default values  for the arguments of the function
        are "0,2, roundedview.txt". 
        Simple one-line example with roundview.py script in current working
        directory--check by typing 'pwd' and 'ls *.py' on the command line. PyMOL
        should return 'roundview.py' in the lisf of files in the external (top) gui.
        Next, paste the following command on the external (top) commandline, hit
        return, and wait 5-10 seconds:
        fetch 1lw9, async=0; run roundview.py; roundview 0,1
        The following view setting will be returned without the blackslash.
        set_view (1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,-155.2,35.1,11.5,9.7,122.3,188.0,-20.0);
        Advanced option:
        Copy roundview.py to the folder ~/.pymol/startup and then
        the command will always be accessible. You may have to 
        create these directories. 
        18 elements of the view matrix (0-17)
        0 - 8 = column-major 3x3 matrix that rotates the model axes
        to camera axes 
        9 - 11 = origin of rotation relative to the camera
        in camera space
        12 - 14 = origin of rotation in model space
        15 = front plane distance from the camera
        16 = rear plane distance from the camera
        17 = orthoscopic flag 
        (not implemented in older versions)
        
        """
        
        #convert the commandline arguments from strings to integers
    
        StoredView = int(StoredView)
        decimal_places = int(decimal_places)
        
        
        #call the get_view function
    
        m = cmd.get_view(StoredView)
    
    
        #Make a list of the elements in the orientation matrix.
    
        myList = [m[0], m[1], m[2], m[3], m[4], m[5], m[6],
            m[7], m[8], m[9], m[10], m[11], m[12], m[13], m[14],
            m[15], m[16], m[17]]
    
    
        #Round off the matrix elements to two decimal places (two fractional places)
        #This rounding approach solved the problem of unwanted
        #whitespaces when I tried using a string format statement
    
        myRoundedList = [ round(elem, decimal_places) for elem in myList]
        
        
        #x is the format of the output. The whitespace is required
        #between the "set_view" and "(".
        
        x = 'set_view ({0},{1},{2},{3},{4},{5},{6},{7},\
    {8},{9},{10},{11},{12},{13},{14},{15},{16},{17});'
    
    
        #print to the external gui.
    
        print x.format(*myRoundedList)
    
    
        #Write to a text file.
    
        myFile = open("roundedview.txt", "a")
        myFile.write(x.format(*myRoundedList) + "\n")
        myFile.close()
        return
    
    
        #The extend command makes roundview into a PyMOL command.
    
    cmd.extend("roundview", roundview)

    public by TheFreeman193 modified Wednesday at 5:35:41 PM  23  0  3  0

    Elevate batch script

    Checks for elevation with fsutil, if not found will elevate the current script and terminate the original instance.
    fsutil dirty query %SYSTEMDRIVE% >nul
    if ERRORLEVEL 1 (start /min "" powershell -Command "Start-Process -FilePath '%~f0' -Verb runas" & exit /b)

    public by azazqadir modified Tuesday at 7:43:11 PM  52  0  2  0

    LEMP on Debian

    Learn how to install LEMP on Debian: https://www.cloudways.com/blog/how-to-create-a-lemp-stack-on-debian-server/
    php
    location ~ \.php$ {
    
                   
    
                   fastcgi_pass unix:/var/run/php5-fpm.sock;
    
                   fastcgi_index index.php;
    
                   fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    
                   include fastcgi_params;
    
                   
    
           }			

    public by dawidkolonski modified Feb 15, 2018  657  0  4  0

    ZXasdad

    ECHO Off
    @%WINDIR%\Microsoft.NET\Framework\v3.5\MSBuild.exe "c:\a\copy.proj"
    set BUILD_STATUS=%ERRORLEVEL% 
    IF NOT %BUILD_STATUS%==0 GOTO ERROR
    GOTO DONE
    
    :ERROR
    ECHO %ERRORLEVEL%
    ECHO --------------------------------------------------
    ECHO ERROR HAS OCCURED
    ECHO --------------------------------------------------
    pause
    GOTO END
    
    :DONE
    ECHO %ERRORLEVEL%
    ECHO "AllOK"
    pause
    :END

    public by Hlinh modified Feb 12, 2018  738  0  5  0

    Product Tabs For Magento 2

    Magento 2 Product Tabs extension allow admin to edit and add unlimited tabs for product details page.Default of magento v2, product details page just showing 3 tabs are: Details, More Information and Reviews. With this extension admin can add unlimited tabs. The tab can be use static blocks or attributes. View more: https://www.magesolution.com/pro
    View more: https://www.magesolution.com/product-tabs-for-magento-2.html						

    public by gwarah modified Feb 9, 2018  699  0  5  0

    mysnaps.sh

    Choose one snap app and run it. syntax: ./mysnaps.sh
    #!/bin/bash
    # program     : mysnaps.sh
    # description : choose one snap app and run it
    # author      : lp (Luís Pessoa)
    # version     : 0.1.0b
    # dependences : 
    #   1) shell: bash 
    #   2) packages awk, snap and zenity installed
    #   3) at least one snap app instaled
    # history     :
    #   lp; 07/02/2018; begin of development
    #   lp; 09/02/2018; first release
    
    ###############
    # functions
    ###############
    
    
    ###############
    # end functions
    ###############
    
    # building snap list header 
    snap_cols="$(snap list | \
    awk '{ if (NR == 1) { for (i = 1; i <= NF; i++)  printf "--column " $i " " }} ')"
    snap_cols="--column check ${snap_cols}"
    
    # building snap list options
    snap_ops=$(snap list | \
    awk '
    BEGIN { }
    {
    if (NR >= 2 ) {
        for (i = 1; i <= NF; i++) {
            
            if ( i == 1 ) {
                if ( $i == "core"  ) break;
                if (NR == 2) {printf "TRUE ";} 
                else {printf "FALSE ";}
            }
            printf $i;
            if ( i == NF ) { print "";}
            else { printf " "; }
       }
    }}')
    
    # snap app selection
    opc=$(zenity  --list  --text "Apps snaped " --radiolist  ${snap_cols} ${snap_ops})
    case $? in
             1)
                    echo "No snap app selected"
                    exit 1
                    ;;
            -1)
                    echo "Error!"
                    exit 1
                    ;;
    esac
    
    # run app selected
    app_opc=`echo $opc | awk '{print $1}'`
    ${app_opc}
    exit $?
    

    public by Hlinh modified Feb 9, 2018  780  0  5  0

    Page Builder for Magento 2 by Magesolution

    Page Builder for Magento 2 allows you to get rid of complicated steps to configure your site with minimal coding experiences required. Instead of login in the back-end, the fabulous feature allows you to build and configure Homepage, Category page, Product page, CMS pages straightly and visually at front-end. Also, it allows you to select header &
    https://www.magesolution.com/mgs-frontend-builder-theme-for-magento2.html						
    • Public Snippets
    • Channels Snippets