Skip to content

Instantly share code, notes, and snippets.

View bfatemi's full-sized avatar
🎯
In my zone

Bobby Fatemi bfatemi

🎯
In my zone
View GitHub Profile
@bfatemi
bfatemi / .bash_profile
Last active October 8, 2021 02:20
bashprofile
alias startpg="sudo service postgresql start"
alias stoppg="sudo service postgresql stop"
alias startrs="sudo service rstudio-server start"
alias stoprs="sudo service rstudio-server stop"
alias aptupdate="sudo apt update && sudo apt upgrade -y"
alias aptclean="sudo apt clean && sudo apt autoclean && sudo apt autoremove -y"
@bfatemi
bfatemi / response.json
Last active August 2, 2021 22:14
reporting/products
[
{
"productId": 0,
"sku": "string",
"productName": "string",
"internalName": "string",
"description": "string",
"masterCategory": "string",
"categoryId": 0,
"category": "string",
@bfatemi
bfatemi / response.json
Last active August 2, 2021 22:13
/reporting/transactions
[
{
"transactionId": 0,
"customerId": 0,
"employeeId": 0,
"transactionDate": "2021-08-02T21:01:20.947Z",
"voidDate": "2021-08-02T21:01:20.947Z",
"isVoid": true,
"subtotal": 0,
"totalDiscount": 0,
@bfatemi
bfatemi / initr.sh
Last active February 16, 2021 07:40
R new install
#!bin/bash
sudo apt-get install -y \
dirmngr \
gnupg \
apt-transport-https \
ca-certificates \
software-properties-common \
libpq-dev \
libssl-dev \
ALTER TABLE greenkong_blaze_members
ALTER COLUMN member_group TYPE JSON
USING member_group::json;
@bfatemi
bfatemi / .gitignore
Created February 21, 2020 23:05
Template gitignore
# History files
.Rhistory
.Rapp.history
# Session Data files
.RData
# User-specific files
.Ruserdata
@bfatemi
bfatemi / clip2vec
Created October 17, 2019 20:32
reads multi-line and delimited text from the clipboard and inserts as values of a vector assignment, at the cursors position.
clip2Vec <- function(toPosition = TRUE, sep = " "){
cb <- clipr::read_clip()
txt <- str_c(
"vec <- c('",
str_replace_all(
string = str_squish(str_flatten(str_subset(cb, ".+"), sep)),
pattern = sep,
replacement = str_c("\',\n", str_dup(' ', 9), "'")
),
"')\n\n"
@bfatemi
bfatemi / gist:b4236850a35d0a9a931d8998bf50ba55
Last active September 24, 2019 00:28
template-pipeline-config.yaml
default:
pipeline:
name: '{%!=name}'
ppid: 2
meta:
origin:
ssnam: '' # source system name
ssurl: '' # populate if api url
destn:
dbms: "postgres" # one of postgres, mssql, mysql, mongod
@bfatemi
bfatemi / gist:e3d1a4961a36d9525681f0a8a79599c9
Created September 18, 2019 23:14
shiny app to explore current session user and more
library(shiny)
library(lubridate)
library(sodium)
library(jsonlite)
ui <- fluidPage(
titlePanel("Explore Session Meta"),
sidebarLayout(
@bfatemi
bfatemi / Rd_viewAsHTML.R
Created September 17, 2019 18:58
generate html page from .Rd file and view it
site_index_path <- tempfile("index_", fileext = ".html")
stopifnot( file.create(site_index_path) )
tools::Rd2HTML(
tools::parse_Rd("man/f_add.Rd"),
out = site_index_path
)
rstudioapi::viewer(site_index_path)