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
package kafka.tools | |
import java.util | |
import java.util.Collections | |
import kafka.consumer.BaseConsumerRecord | |
import kafka.tools.MirrorMaker.MirrorMakerMessageHandler | |
import org.apache.kafka.clients.producer.ProducerRecord | |
import scala.util.matching.Regex |
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
var toSend = {}; | |
var xmlhttp = new XMLHttpRequest(); | |
xmlhttp.open("POST", "https://myserver.com/path", true); | |
xmlhttp.responseType="blob"; | |
xmlhttp.setRequestHeader("Content-Type", "application/json"); | |
xmlhttp.overrideMimeType('application/octet-stream'); | |
xmlhttp.onload = function() { | |
console.log('success'); | |
console.log(xmlhttp.response); | |
window.open(URL.createObjectURL(xmlhttp.response)).focus(); |
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 java.util.Comparator; | |
import java.util.List; | |
/** | |
??? | |
**/ | |
public class Mystery<T extends Comparable<? super T>> implements Comparator<List<T>> { | |
@Override | |
public int compare(List<T> l1, List<T> l2) { |
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 java.util.Comparator; | |
import java.util.List; | |
/** | |
* Compares {@link Comparable} list instances lexicographically. | |
* Assumes that the lists are not null, that they contain no null elements, and that they are optimized for random access! | |
* | |
* <p> | |
* Created by Tolstoyevsky on 08/02/2017. | |
* </p> |
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
git rev-list --objects --all \ | |
| git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' \ | |
| sed -n 's/^blob //p' \ | |
| sort -nrk2 \ | |
| cut -c 1-12,41- |
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 ( | |
"os" | |
"os/exec" | |
"path" | |
"syscall" | |
"testing" | |
"time" | |
) | |
func TestFifo(t *testing.T) { |
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
#!/bin/sh | |
# Usage: gdrive_download 123-abc ./output.zip | |
function gdrive_download () { | |
CONFIRM=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate "https://drive.google.com/uc?export=download&id=$1" -O- | sed -En 's/.*confirm=([0-9A-Za-z_]+).*/\1/p') | |
wget --load-cookies /tmp/cookies.txt "https://drive.google.com/uc?export=download&confirm=$CONFIRM&id=$1" -O $2 | |
rm -f /tmp/cookies.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
[alias] | |
br = branch | |
sh = show | |
rb = rebase | |
rbi = rebase -i | |
st = status | |
ci = commit | |
cim = commit -m | |
cia = commit -a -m | |
co = checkout |
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
(defn exp | |
"exponent of x^n (int n only), with tail recursion and O(logn)" | |
[x n] | |
(if (< n 0) | |
(/ 1 (exp x (- n))) | |
(loop [acc 1 | |
base x | |
pow n] | |
(if (= pow 0) | |
acc |
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
# Put this under .github/workflows/consolidate-prs.yml | |
name: Consolidate PRs | |
on: | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
branches: | |
- master |