Skip to content

Instantly share code, notes, and snippets.

@muranava
muranava / Disable_Hibernate_mode
Created June 26, 2021 14:09 — forked from hariel18/Disable_Hibernate_mode
OSX: Disable Hibernate mode
#http://www.engadget.com/2011/08/22/why-hibernate-or-safe-sleep-mode-is-no-longer-necessary-in-os/
#https://www.idelta.info/archives/some-hidden-changes-in-os-x-el-capitan/
# disable hibernation
sudo pmset hibernatemode 0
# clear the image file
sudo rm -rf /var/vm/sleepimage
# inhibit file recreation
@muranava
muranava / video-player.html
Created December 10, 2020 14:52 — forked from simonhaenisch/video-player.html
Play local video files in the browser (HTML5 video player) with playlist, speed control and keyboard shortcuts for pause (spacebar) and 5 second jump (left/right arrow). Created to watch Wes Bos tutorials offline. Playback speed defaults to 2x.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Local HTML5 Video Player</title>
</head>
<body>
<style>
* { box-sizing: border-box; }
@muranava
muranava / debate3.txt
Created October 20, 2016 18:39 — forked from paigecm/debate3.txt
3rd presidential debate text
WALLACE: Good evening from the Thomas and Mack Center at the University of Nevada, Las Vegas. I’m Chris Wallace of Fox News, and I welcome you to the third and final of the 2016 presidential debates between Secretary of State Hillary Clinton and Donald J. Trump.
WALLACE: This debate is sponsored by the Commission on Presidential Debates. The commission has designed the format: Six roughly 15-minute segments with two-minute answers to the first question, then open discussion for the rest of each segment. Both campaigns have agreed to those rules.
For the record, I decided the topics and the questions in each topic. None of those questions has been shared with the commission or the two candidates. The audience here in the hall has promised to remain silent. No cheers, boos, or other interruptions so we and you can focus on what the candidates have to say.
WALLACE: No noise, except right now, as we welcome the Democratic nominee for president, Secretary Clinton, and the Republican nominee for president, Mr. Trum
@muranava
muranava / debates3.php
Created October 20, 2016 18:37 — forked from paigecm/debates3.php
Script for separating the third presidential debate by speaker
<?php
#Thanks to the VoyantTools Twitter (@VoyantTools) for the original php script!)
$dirname = dirname(__FILE__);
$filename = "debate3.txt"; #assumes you have https://gist.github.com/paigecm/52ce175a98a3f0baa76dc0847c445b5e
$speaker = ""; $speeches = array();
foreach(file("$dirname/$filename") as $line) {
$withoutname = preg_replace("/^(WALLACE|CLINTON|TRUMP):/","", $line);
if ($line!=$withoutname) {
$speaker = substr($line, 0, strpos($line, ":"));
}
library(tidyverse)
library(stringr)
# read in the transcript
# I simply copied the text from the page at
# https://www.washingtonpost.com/news/the-fix/wp/2016/09/26/the-first-trump-clinton-presidential-debate-transcript-annotated/
# and popped it into a txt file
xx <- scan("first_debate_2016.txt", "character")
@muranava
muranava / tweet_dumper.py
Created February 19, 2016 14:43 — forked from yanofsky/LICENSE
A script to download all of a user's tweets into a csv
#!/usr/bin/env python
# encoding: utf-8
import tweepy #https://github.com/tweepy/tweepy
import csv
#Twitter API credentials
consumer_key = ""
consumer_secret = ""
access_key = ""
#!/usr/bin/env python
from nltk import Text
from nltk.corpus import PlaintextCorpusReader
CORPUS_ROOT = '/Users/benjamin/Development/corpora/gutenburg/'
if __name__ == "__main__":
reader = PlaintextCorpusReader(CORPUS_ROOT, '.*')
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Canvas Hexagonal Map</title>
<style type="text/css">
canvas {
border:0;
display:block;
margin:0 auto;
# R code for basic collocation statistics on a text corpus.
# Extracts LHS and RHS collocates of a word of interest
# over a user-defined span. Calculates frequency of
# collocates and mean distances.
examp1 <- "When discussing performance with colleagues, teaching, sending a bug report or
searching for guidance on mailing lists and here on SO, a reproducible example is often
asked and always helpful. What are your tips for creating an excellent example? How do
you paste data structures from r in a text format? What other information should you
include? Are there other tricks in addition to using dput(), dump() or structure()?
<html>
<head>
<title>Flash Cards</title>
<link href='http://fonts.googleapis.com/css?family=Montserrat' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Open+Sans+Condensed:300' rel='stylesheet' type='text/css'>
<style type="text/css">
html, body {
height: 100%;
margin: 0;