Example taken from https://github.com/davidroyer/nuxt-markdown-example
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
| library(tabulizer) | |
| #### PARAMETERS #### | |
| target_str <- "An analysis of the financial provision under Subhead 000 Operational expenses is as follows" | |
| filename <- "head156.pdf" | |
| year <- 2012 | |
| #################### | |
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
| # R version of | |
| #https://hackernoon.com/functional-computational-thinking-what-is-a-monad-2adea91154e | |
| library(magrittr) | |
| readLines("./file1") %>% readLines() | |
| readFileCPS <- function(path, cb){ | |
| cb(readLines(path)) | |
| } | |
| composeCPS <- function(g,f){ |
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
| tokens_pool <- function(tokens){ | |
| current_count <- 1 | |
| list(get_next_token = function(){ | |
| current_count <<- current_count +1 | |
| if(current_count>length(tokens)){ | |
| current_count <<- 1 | |
| } | |
| return(tokens[[current_count]]) | |
| }, | |
| get_current_token = function(){ |
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
| param( | |
| [string]$baseDir = "C:\SomeFolderToStoreTheData\", | |
| [string]$bw_client = "000", | |
| [string]$bw_user = "YOURUSERNAME", | |
| [string]$bw_password = "YOURPASSWORD", | |
| [string]$filePath = "Path to Analysis Office Excel.xlsx", | |
| [string]$year_column = "Analysis Technical Name of Year column" | |
| ) | |
| # Essentially the Powershell version of https://blogs.sap.com/2016/12/18/automated-updating-of-data-in-excel-files-bex-ao-via-vbavbscript/ |
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://simpy.readthedocs.io/en/latest/examples/bank_renege.html | |
| Bank renege example | |
| Covers: | |
| - Resources: Resource | |
| - Condition events | |
| Scenario: |
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
| sudoku_board <- rbind(c(9, NA, 6,8,NA, NA, 3, NA, NA), | |
| c(NA, NA, NA, NA, 7, NA, NA, NA, NA), | |
| c(NA, NA, 1, NA, NA, NA, 6, NA, 2), | |
| c(NA, NA, NA, NA, 6, NA, 1, NA, 5), | |
| c(NA, 7, NA, NA, 5, NA, NA, 3, NA), | |
| c(6, NA, 3, NA, 8, NA, NA, NA, NA), | |
| c(4, NA, 2, NA, NA, NA, 5, NA, NA), | |
| c(NA, NA, NA, NA, 1, NA, NA, NA, NA), | |
| c(NA, NA, 5, NA, NA, 4, 9, NA, 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
| from pyproj import Proj, transform | |
| # lat-long to HK coordinates | |
| hk_proj = Proj(init='epsg:2326') # HK1980 projection | |
| latlon_proj = Proj(init='epsg:4326') # lat lon projection | |
| x1,y1 = transform(latlon_proj, hk_proj, float(lon), float(lat)) |
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 os | |
| import pandas as pd | |
| from openpyxl import load_workbook | |
| wb = load_workbook(filename='raw_data/A02.xlsx', | |
| data_only=True) | |
| ws = wb['A02e'] |
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 pandas as pd | |
| import numpy as np | |
| START_YEAR = 2007 | |
| END_YEAR = pd.datetime.today() | |
| def main(): | |
| df = pd.DataFrame() | |
| df['Day'] = pd.date_range(str(START_YEAR), str(END_YEAR)) | |
| df['Month'] = df.Day.map(lambda x: "%d-%02d" % (x.year, x.month)) |