This sample, demonstrates how to write and read a python dict data as a json object to a file
{| import React, { useState, useEffect, useCallback } from 'react' | |
| function Posts() { | |
| const [isLoading, setIsLoading] = useState(true) | |
| const [posts, setPosts] = useState([]) | |
| const fetchPosts = useCallback(async controller => { | |
| try { | |
| // Imagine that the fetch is going to take 3 seconds to finish | |
| await new Promise(resolve => setTimeout(resolve, 3000)) |
| ########## Install NGINX ############## | |
| # Install software-properties-common package to give us add-apt-repository package | |
| sudo apt-get install -y software-properties-common | |
| # Install latest nginx version from community maintained ppa | |
| sudo add-apt-repository ppa:nginx/stable | |
| # Update packages after adding ppa |
| #!/usr/bash | |
| wget https://dl.pstmn.io/download/latest/linux64 -O postman.tar.gz | |
| sudo tar -xzf postman.tar.gz -C /opt | |
| sudo ln -s /opt/Postman/Postman /usr/bin/postman | |
| #Create a Desktop Entry | |
| cat > ~/.local/share/applications/postman.desktop <<EOL | |
| [Desktop Entry] | |
| Encoding=UTF-8 | |
| Name=Postman |
| # Author: Zameer Ansari | |
| # You should look at the following URL's in order to grasp a solid understanding | |
| # of Nginx configuration files in order to fully unleash the power of Nginx. | |
| # http://wiki.nginx.org/Pitfalls | |
| # http://wiki.nginx.org/QuickStart | |
| # http://wiki.nginx.org/Configuration | |
| # | |
| # Generally, you will want to move this file somewhere, and start with a clean | |
| # file but keep this around for reference. Or just disable in sites-enabled. | |
| # |
| function getPaginatedItems(items, page, pageSize) { | |
| var pg = page || 1, | |
| pgSize = pageSize || 100, | |
| offset = (pg - 1) * pgSize, | |
| pagedItems = _.drop(items, offset).slice(0, pgSize); | |
| return { | |
| page: pg, | |
| pageSize: pgSize, | |
| total: items.length, | |
| total_pages: Math.ceil(items.length / pgSize), |
Here we will make two .desktop files that will launch Pupil Capture and Pupil Player.
.desktopNote: Change the X-Icon-Path to the icon you want to use and Execpath to where Pupil Capturemain.py` is located on your machine (see example pupil.desktop for reference)
<hash> with your gist's hash):
# with ssh
git clone [email protected]:<hash>.git mygist
# with httpsgit clone https://gist.github.com/.git mygist