Skip to content

Instantly share code, notes, and snippets.

Avatar
🎲
RAND()

Mikhail Popov bearloga

🎲
RAND()
View GitHub Profile
View tweet_deleting_script.py
# -*- coding: utf-8 -*-
""" Deletes all tweets below a certain retweet threshold.
"""
import tweepy
from datetime import datetime
# Constants
CONSUMER_KEY = ''
@noamross
noamross / mkrproj.sh
Last active Jan 17, 2018 — forked from bearloga/mkrproj.sh
A bash shell script that can be used to turn the current directory into an RStudio project, opening the project in RStudio after creating it.
View mkrproj.sh
#!/bin/bash
# Usage: mkproj [projectname]
# projectname defaults to name of current directory
template="Version: 1.0
RestoreWorkspace: No
SaveWorkspace: No
AlwaysSaveHistory: Yes
View 2017 Fantasy Football Projections.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@veekaybee
veekaybee / wholesome-data-science.md
Last active Aug 16, 2019
Wholesome data science.
View wholesome-data-science.md

Wholesome Data Science

Data science has a really bad reputation recently. Between Facebook's privacy violations , facial scanning at kiosks in restaurants, and racism in algorithms, there are a lot of cases where surveillance, invasion of privacy, and unethical algorithms are dominating the news.

These cases are really important to make public, study, and prevent. But it's just as important to collect examples of good use cases of data science (that are not hyperbolized or PR fluff) so we can focus on those as an industry, and learn about what makes them work, as well.

Have some? Make some? Feel free to leave a comment or edit.

Examples

View generalizedsparklevulnfinder.r
library(purrr)
library(dplyr)
library(XML)
read_plist <- safely(readKeyValueDB)
safe_compare <- safely(compareVersion)
apps <- list.dirs(c("/Applications", "/Applications/Utilities"), recursive=FALSE)
# if you have something further than this far down that's bad you're on your own
@hrbrmstr
hrbrmstr / ghelp.R
Last active Aug 29, 2015
github search in rstudio viewer pane - source it and try it with ghelp("vapply")
View ghelp.R
ghelp <- function(topic, in_cran=TRUE) {
require(htmltools) # for getting HTML to the viewer
require(rvest) # for scraping & munging HTML
# github search URL base
base_ext_url <- "https://github.com/search?utf8=%%E2%%9C%%93&q=%s+extension%%3AR"
ext_url <- sprintf(base_ext_url, topic)
# if searching with user:cran (the default) add that to the URL
@noamross
noamross / disease_tweeps.R
Last active Aug 29, 2015
I wanted to make a list of my disease ecology followers and followees on twitter, so...
View disease_tweeps.R
library(twitteR)
library(rlist)
library(pipeR)
library(stringi)
# Authenticate with twitter
# consumer/access keys and secrets for the twitter API must be defined elsewhere
setup_twitter_oauth(consumer_key, consumer_secret, access_token, access_secret)
# Get all my followers and followees
@abresler
abresler / tufte
Last active Jul 19, 2020
Recreating Edward Tufte's New York City Weather Visualization
View tufte
library(dplyr)
library(tidyr)
library(magrittr)
library(ggplot2)
"http://academic.udayton.edu/kissock/http/Weather/gsod95-current/NYNEWYOR.txt" %>%
read.table() %>% data.frame %>% tbl_df -> data
names(data) <- c("month", "day", "year", "temp")
data %>%
group_by(year, month) %>%
View shiny-password.R
library("shiny")
x <- runApp(shinyApp(
fluidPage(
"Password:",
tags$input(id = "password", type = "password"),
actionButton("done", "Done")
),
function(input, output) {
observe({
View #ButtGate
javascript:(function(){var g="#gamergate";var f=function(t){return t.split(' ').map(function(w){return w.toLowerCase()==g?w:'butt'}).join(' ')};var es=document.getElementsByClassName("tweet-text");for(var i=0;i<es.length;i++){if(es[i].innerText.toLowerCase().indexOf(g)>0)es[i].innerText=f(es[i].innerText)}})()