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
| Sub CallPlumberAPI() | |
| Dim SERVER_URL As String | |
| Dim xmlhttp As Object | |
| Dim ws As Worksheet | |
| Dim inputRange As Range, dataRange As Range, outputRange As Range | |
| Dim cellAddress As String, rCode As String, outputAddress As String | |
| Dim i As Long, j As Long | |
| Dim tsvData As String, processedData As String | |
| Dim outputData() As String, outputRow() As String | |
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
| # Made with ChatGPT | |
| # Required packages: | |
| # - Pillow | |
| # - imageio | |
| # - imageio-ffmpeg | |
| # - numpy | |
| # Usage example: | |
| # create_panning_video('My_Pano_image.jpg', 'My_Pano_video.mp4', 90, 60) | |
| from PIL import Image | |
| import imageio |
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(data.table) | |
| library(magrittr) | |
| ## Pattern: | |
| # DT[DT[,row_filtering_expression, by=grouping_column][[2]]] | |
| ## or generally | |
| # DT[DT[,row_filtering_expression, by=.(grouping_col1,grouping_col2,etc.)][[number_of_grouping_cols+1]]] | |
| ## Example: | |
| data.table(a=c(1,1,1,2,2), |
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
| ### Usage: | |
| # a = 1; b = 2 | |
| # my_result <- eval.async(a+b) | |
| ### when mirai::unresolved(my_result) == FALSE | |
| ### you can use my_result$data | |
| ### do.call.async can be used like do.call | |
| eval.async <- |
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 random | |
| import string | |
| while True: | |
| folder_path = input("Please enter the folder path: ") | |
| # Check if the path is a valid directory | |
| if os.path.isdir(folder_path): | |
| print(f"Valid directory: {folder_path}") |
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
| memoryAddress <- function(x) | |
| strsplit(capture.output(.Internal(inspect(x))),split=" ")[[1]][1] | |
| ### Usage examples | |
| # > abc <- c(1,2,3,10,11) | |
| # > xyz <- abc | |
| # > memoryAddress(abc)==memoryAddress(xyz) | |
| # [1] TRUE | |
| # > xyz <- abc+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
| listWithoutEmptyArgs <- function(...) | |
| eval(Filter(\(x) !identical(as.character(x), "") || identical(x,""), | |
| bquote(.(substitute(list(...)))))) | |
| # > list(a=1,,b=2:10) | |
| # Error in list(a = 1, , b = 2:10) : argument 2 is empty | |
| # > listWithoutEmptyArgs(a=1,,b=2:10) | |
| # list(a = 1, b = 2:10) |
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
| options(shiny.sanitize.errors = FALSE) | |
| library(shiny) | |
| library(data.table) | |
| library(eurodata) | |
| library(magrittr) | |
| MetaBase <- | |
| importMetabase() %>% |
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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Keyboard Shortcut Cheatsheet Generator</title> | |
| <link rel="stylesheet" href="styles.css"> | |
| </head> | |
| <body> | |
| <div class="container"> |
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
| // Usage example: | |
| // Either the parameter is Eurostat's "online data code": | |
| // insheet_eurostat nama_10_gdp | |
| // or the parameter is the custom URL generated with Eurostat GUI top right corner: | |
| // Go to e.g. https://ec.europa.eu/eurostat/databrowser/view/nama_10_gdp/default/table?lang=en and | |
| // do your selections by clicking | |
| // ⤓ Download > Advanced settings > Select: File format = "Text (.tsv)", Select: Data scope = "All selected dimensions", and untick "Compress file (.gzip)" > Click: [Copy] button next to the "API link" | |
| // insheet_eurostat https://ec.europa.eu/eurostat/api/dissemination/sdmx/2.1/data/nama_10_gdp/A.CP_MEUR.B1G+P3.EU27_2020+BE+BG+CZ+DK/?format=TSV&startPeriod=2021&endPeriod=2023 | |
| // To use it like other commands, put it in your "personal" folder/directory | |
| // (see: https://www.stata.com/support/faqs/programming/personal-ado-directory/ and https://www.stata.com/help.cgi?personal). |