Skip to content

Instantly share code, notes, and snippets.

@anton0xf
anton0xf / evince-bookmarks-to-pdftk-outline.md
Last active January 10, 2022 09:05
Convert evince bookmarks to PDF outline

extract bookmarks:

$ gio info -a "metadata::evince::bookmarks" coq-art.pdf \
    | sed -n '/metadata::/ s/^.*: //p' > coq-art.bookmarks

and restore its by:

gio set coq-art.pdf 'metadata::evince::bookmarks' "$(cat coq-art.bookmarks)"
@anton0xf
anton0xf / Main.java
Created November 26, 2020 11:46
мой пример к "кружку про ООП"
import java.io.IOException;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.function.Function;
import java.util.stream.Collectors;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
@anton0xf
anton0xf / FibTest.java
Last active October 16, 2020 06:54
OK task 1
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class FibTest {
@anton0xf
anton0xf / OffMap.java
Created October 16, 2020 06:44
OK task 2
interface OffMap {
long get();
void close();
}
class Wrap implements OffMap {
@anton0xf
anton0xf / Handler.java
Created October 16, 2020 06:42
OK task 3
class Handler {
public final int MAX_SIZE = 1_000_000_000;
private StringBuilder buf = new StringBuilder(MAX_SIZE);
public void put(char letter) {
buf.append(letter);
}
public void get(OutputStream outputStream) throws IOException {
@anton0xf
anton0xf / game.html
Last active September 24, 2019 17:14
<!DOCTYPE html>
<html>
<head>
<title>Game</title>
<meta charset="UTF-8"/>
<script>
window.onload = function() {
(function(elid, wi, he, exp, pot, gld, hp, lvl, cur_e, e_sz){
var hit = function(){
evs[cur_e][8]-=lvl*4+6;
// ==UserScript==
// @name wide startek
// @namespace Violentmonkey Scripts
// @match https://st.yandex-team.ru/*
// @grant none
// @inject-into content
// ==/UserScript==
const elt = document.getElementsByClassName('b-page-layout__main')[0];
elt.style.maxWidth = '100%';
@anton0xf
anton0xf / hot queries
Created April 6, 2016 07:59
hot queries
dao.query count (times/s, m1) duration (ms, mean) count*duration
--- --- --- ---
com.navixy.apiserver.storage.dao.HistoryDao.getUnreadCountTrackers 16.910988115064935 34.52788928728147 583.9007253754947
com.navixy.apiserver.storage.dao.ChatMessagesDao.getUnreadIncomingCounts 23.00383369376803 19.755927569260955 454.4620722694059
com.navixy.apiserver.storage.dao.TrackerDao.getTrackerInfo 20.156757997465466 21.37336715330609 430.8177893001683
com.navixy.apiserver.storage.dao.SensorDao.getDiscreteInputs 16.539122047415464 24.782417269824435 409.8794238556031
com.navixy.apiserver.storage.dao.HistoryDao.getTrackersHistory 10.926893378445559 33.5619322390539 366.7276551507566
com.navixy.apiserver.storage.dao.SensorDao.getSensors
@anton0xf
anton0xf / task.js
Last active February 9, 2016 11:16
рещение задачи из https://gist.github.com/076a01c53ef1b5701fc2
function Node(data, left, right) {
this.data = data;
this.left = left || null;
this.right = right || null;
this.neighbour = null;
}
Node.prototype.toString = function() {
return "(" + this.data
+ " [" + (this.left || ".") + " " + (this.right || ".") + "]"
2015-11-05 11:05:00,658 WARN [TestScheduler_Worker-1] c.n.a.jobs.CheckVehicleServiceTasksJob [CheckVehicleServiceTasksJob.java:86] uid=3 Service task check failed VehicleServiceTaskToCheck{trackerId=15565, userI
d=3}VehicleServiceTask{comment=, start=ServiceTaskStartPosition{mileage=0, date=2015-11-02T05:16:56.000Z, engineHours=0}, conditions=ServiceTaskConditions{mileage=null, date=DateServiceTaskCondition{end=2015-11-
07T19:00:00.000Z, notificationInterval=3} , engineHours=null}, notifications=ServiceTaskNotificationSettings{smsPhones=[], emails=[], pushEnabled=false}} VehicleServiceTaskBase{vehicleId=18, status=notified, pre
diction=null, description=Почистить пепельницу, cost= 1000000.0000} Identifiable{id=51}
com.navixy.common.storage.StorageException: Failed calling com.navixy.apiserver.storage.dao.VehicleDao.changeServiceTaskStatus
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.7.0_67]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstr