Skip to content

Instantly share code, notes, and snippets.

View pokyah's full-sized avatar
🎯
Focusing

pokyah pokyah

🎯
Focusing
View GitHub Profile
@pokyah
pokyah / GetGmailEmails.gs
Created November 23, 2020 09:43 — forked from moayadhani/GetGmailEmails.gs
Get Gmail Emails By Assigned Label
var ui = SpreadsheetApp.getUi();
function onOpen(e){
ui.createMenu("Gmail Manager").addItem("Get Emails by Label", "getGmailEmails").addToUi();
}
function getGmailEmails(){
var input = ui.prompt('Label Name', 'Enter the label name that is assigned to your emails:', Browser.Buttons.OK_CANCEL);

Keybase proof

I hereby claim:

  • I am pokyah on github.
  • I am pokyah (https://keybase.io/pokyah) on keybase.
  • I have a public key whose fingerprint is DD9D 579D 4F63 83A4 4141 FEE0 CC7D 198F 733D 2F25

To claim this, I am signing this object:

@pokyah
pokyah / debugging_RWeka_install.Rmd
Created May 29, 2018 13:00 — forked from mmulvahill/debugging_RWeka_install.Rmd
Getting R, Java, and RWeka to play nice
# R, Java, and RWeka errors
**TL;DR version**
On macOS
1. Make sure up-to-date Java JDK is installed
2. Reconfigure R's java paths: R CMD javareconf
3. Install rJava from source: install.packages("rJava", type = 'source')
4. Install RWeka: install.packages("RWeka")
@pokyah
pokyah / postgres-docker-config.sh
Created February 16, 2018 10:53 — forked from averagehuman/postgres-docker-config.sh
Run postgres on docker host, connect from docker containers
#!/bin/bash
################################################################################
# Rather than run postgres in its own container, we want to run it on
# the (Ubuntu) host and allow:
#
# + peer connections on the host
# + local md5 connections from any docker container
#
# THIS IS COPY/PASTED FROM COMMAND LINE INPUT AND IS UNTESTED AS A SINGLE SCRIPT
################################################################################
@pokyah
pokyah / remove_user_packages.R
Created August 18, 2017 11:26 — forked from Mikuana/remove_user_packages.R
Remove all user installed packages from R
# Shamlessly stolen from:
# https://www.r-bloggers.com/how-to-remove-all-user-installed-packages-in-r/
# create a list of all installed packages
ip <- as.data.frame(installed.packages())
head(ip)
# if you use MRO, make sure that no packages in this library will be removed
ip <- subset(ip, !grepl("MRO", ip$LibPath))
# we don't want to remove base or recommended packages either\
ip <- ip[!(ip[,"Priority"] %in% c("base", "recommended")),]
@pokyah
pokyah / weather.R
Created July 17, 2017 07:24 — forked from richfitz/weather.R
Download some weather data from openweathermap.org
library(RCurl)
library(rjson)
url.base <- function()
"http://api.openweathermap.org/data"
city.to.id <- function(city, country="AU") {
url <- sprintf("%s/2.5/find?q=%s", url.base(), city)
res <- fromJSON(getURLContent(url))
if (!is.null(country)) {

How to work with R, packrat and git ?

packrat

Packrat is a dependency manager for R. When installed and enabled, the R packages required for your project will be saved in a project private library instead of the system library. This means that you can have multiple versions of packages for different projects. It also allow to move a project with all its dependencies from a computer to the other withour the need to reinstall all the packages on the other computer.

git

@pokyah
pokyah / Install Spotify (v 0.9.17) on openSUSE 13.2 and openSUSE Leap 64-bit
Created June 13, 2017 14:26 — forked from olejon/Install Spotify 0.9 on openSUSE 64-bit
Install Spotify (v 0.9.17) on openSUSE 13.2 and openSUSE Leap 64-bit
# START GUIDE
# Make sure you copy the whole lines into Terminal. Each command is on one line.
# Open Terminal and become root
sudo -s
# Update system
zypper ref

There are packages for this now!

2016-10-28: Since I wrote this in 2014, the universe, specifically Kirill Müller (https://github.com/krlmlr), has provided better solutions to this problem. I now recommend that you use one of these two packages:

  • rprojroot: released on CRAN and developed on GitHub. This is the main package with functions to help you express paths in a way that will "just work" when developing interactively in an RStudio Project and when you render your file.
  • here: not yet released on CRAN but available on GitHub. A lightweight wrapper around rprojroot that anticipates the most likely scenario: you want to write paths relative to the top-level directory, defined as an RStudio project or Git repo.

I use these packages now instead of what I describe below. I'll leave this gist up for historical interest. 😆

TL;DR

@pokyah
pokyah / functions.php
Created March 31, 2017 09:45 — forked from About2git/functions.php
Shrinking header in Genesis similar to that in Centric Pro
//* Enqueue Scripts
add_action( 'wp_enqueue_scripts', 'custom_load_scripts' );
function custom_load_scripts() {
wp_enqueue_script( 'shrinking-header', get_bloginfo( 'stylesheet_directory' ) . '/js/shrinking-header.js', array( 'jquery' ), '1.0.0', true );
}