View extractCommentsWithPageNum.groovy
This file contains 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
/* | |
* Copyright (c) 2018, Venkatesh-Prasad Ranganath | |
* | |
* Licensed under BSD 3-clause License | |
* | |
* Author: Venkatesh-Prasad Ranganath | |
* | |
* Adapted from https://stackoverflow.com/questions/33253757/java-apache-pdfbox-extract-highlighted-text | |
*/ |
View hostfile
This file contains 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
localhost slots=9 |
View synchronized_collection_issue.jsh
This file contains 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
Collection<Integer> ss = Collections.synchronizedSet(new HashSet<Integer>()); | |
new Thread() { | |
public void run() { | |
for (int x = 0; x < 1000; x++) { | |
ss.addAll(IntStream.range(x*1000, (x + 1)*1000) | |
.boxed() | |
.collect(Collectors.toList())); | |
} | |
} | |
}.start() |
View update_packages_to_new_r_version.r
This file contains 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(gtools) | |
installed <- c() | |
update <- function(p) { | |
pd <- packageDescription(p, fields=c('Built')) | |
pd <- gsub(";.*", "", pd) | |
if (!is.na(pd) && pd != 'R 4.0.4') { # mention the target versions here | |
for (d in getDependencies(p)) { | |
update(d) |
View python_performance1.py
This file contains 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 random | |
import statistics | |
from timeit import default_timer as timer | |
def time_function(f, data): | |
times = [] | |
for _ in range(0, 20): | |
start = timer() | |
f(data) | |
times.append(timer() - start) |
View modification_time_based_file_organizer.py
This file contains 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 argparse | |
import glob | |
import hashlib | |
import logging | |
import os | |
import pathlib | |
import re | |
import shutil | |
import sys | |
import time |
View config.txt
This file contains 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
hdmi_safe=1 | |
enable_uart=0 | |
gpu_mem=16 |
View variance.kt
This file contains 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
class Producer<out T: Any>(val e:T) { | |
fun read(): T = e | |
} | |
class Consumer<in T: Any>() { | |
private lateinit var e: T | |
fun write(v: T): Unit { e = v } | |
} | |
fun main() { |
View howManyLongsCanWeLoad.scala
This file contains 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 scala.collection.mutable.ArrayBuffer | |
import scala.util.Random | |
object M { | |
def main(args: Array[String]) { | |
val t = new ArrayBuffer[Long]() | |
while (true) { | |
t += Random.nextLong | |
if (t.length % 10000 == 0) { | |
System.gc() |
NewerOlder