This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
import random as rnd | |
import numpy as np | |
from PIL import Image | |
from itertools import cycle | |
def main(): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Parser: | |
def __init__(self, infix): | |
self.__infix = infix | |
self.__postfix = "" | |
self.__operators = ['+', '-', '*', '/', '^'] | |
def parse(self): | |
self.__infix_to_postfix() | |
return self.__eval_postfix() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# =============================================== | |
# === ANALISI SPAZIALE CON R === | |
# === AUTHORS: Edbali Ossama, Gazzini Thommy === | |
# =============================================== | |
# ========================================= | |
# === PARTE 1: VISUALIZZAZIONE DATASETS === | |
# ========================================= | |
# Carica dataset "meuse" (fiume Mosa) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scipy | |
def PoissonPP( rt, Dx, Dy=None ): | |
''' | |
Determines the number of events `N` for a rectangular region, | |
given the rate `rt` and the dimensions, `Dx`, `Dy`. | |
Returns a <2xN> NumPy array. | |
''' | |
if Dy == None: | |
Dy = Dx |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function up() { | |
if [ $# -ne 1 ] | |
then | |
echo "You must provide one argument. e.g. 'up 4'" | |
fi | |
START=1 | |
END=$1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_prop(d, path): | |
""" | |
Gets the value of a nested dictionary specified by the path | |
d: the dictionary to search recursively | |
path: a string path | |
""" | |
if d is None or not isinstance(d, dict) or not path: | |
return d | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ mkdir awesome_website | |
$ cd awesome_website | |
$ statico | |
==== CREATE SITE ==== | |
✓ settings.json | |
✓ atom.xml | |
✓ Static assets | |
✓ Templates |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NB: Ensure that the "Regex" checkbox is checked. | |
In the "replace what" bar (replace single-quotes with double-quotes if necessary): | |
\$var_name\['(.+?)'] | |
In the "replace to" bar: | |
\\$var_name->$1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import curses | |
import math | |
import sys | |
import textwrap | |
def print_page(screen, pages, index): | |
screen.clear() | |
screen.addstr(0, 30, f'({index + 1})') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ------------------------------------------------------------------------------------------------- | |
# Adapted from https://www.bioconductor.org/packages/release/bioc/vignettes/xcms/inst/doc/xcms.html | |
# The below example uses a subset of the data in the investigation of the metabolic consequences | |
# of knocking out the fatty acid amide hydrolase (FAAH) gene in mice. | |
if (!require("BiocManager", quietly = TRUE)) { | |
install.packages("BiocManager") | |
} | |
if (!("xcms" %in% rownames(installed.packages()))) { |