Skip to content

Instantly share code, notes, and snippets.

View daniilS's full-sized avatar

Daniil Soloviev daniilS

  • University of Cambridge
  • Cambridge, UK
View GitHub Profile
@daniilS
daniilS / silenceRemover.user.js
Last active November 15, 2020 17:04
Skips annoying silences in lecture recordings, and suppresses noise
// ==UserScript==
// @name Lecture recording silence and noise remover
// @namespace https://gist.github.com/daniilS/
// @downloadUrl https://gist.github.com/daniilS/32ddbd3557bf34385ab6539bd4154007/raw/silenceRemover.user.js
// @version 2.0.0
// @description Puts more effort into making online lectures tolerable than the rest of the chemistry department combined
// @author daniilS
// @include *://*.panopto.*/Panopto/Pages/Viewer.aspx*
// @grant GM_registerMenuCommand
// @grant unsafeWindow
@daniilS
daniilS / longestCommonSubstring.js
Created January 26, 2018 15:12
Multiply and surrender
//helper function
String.prototype.cut = function(index){
return this.slice(0, index) + this.slice(index+1);
}
function longestCommonSubstring(a, b){
if(a.length == 0 || b.length == 0)
return 0;
if(a == b)
"use strict";function diff_match_patch(){this.Diff_Timeout=1,this.Diff_EditCost=4,this.Match_Threshold=.5,this.Match_Distance=1e3,this.Patch_DeleteThreshold=.5,this.Patch_Margin=4,this.Match_MaxBits=32}var DIFF_DELETE=-1,DIFF_INSERT=1,DIFF_EQUAL=0;diff_match_patch.Diff,diff_match_patch.prototype.diff_main=function(e,t,n,i){"undefined"==typeof i&&(i=this.Diff_Timeout<=0?Number.MAX_VALUE:(new Date).getTime()+1e3*this.Diff_Timeout);var s=i;if(null==e||null==t)throw new Error("Null input. (diff_main)");if(e==t)return e?[[DIFF_EQUAL,e]]:[];"undefined"==typeof n&&(n=!0);var r=n,o=this.diff_commonPrefix(e,t),a=e.substring(0,o);e=e.substring(o),t=t.substring(o),o=this.diff_commonSuffix(e,t);var c=e.substring(e.length-o);e=e.substring(0,e.length-o),t=t.substring(0,t.length-o);var u=this.diff_compute_(e,t,r,s);return a&&u.unshift([DIFF_EQUAL,a]),c&&u.push([DIFF_EQUAL,c]),this.diff_cleanupMerge(u),u},diff_match_patch.prototype.diff_compute_=function(e,t,n,i){var s;if(!e)return[[DIFF_INSERT,t]];if(!t)return[[DIFF_DELETE,
@daniilS
daniilS / cambridge_stats.user.js
Last active January 27, 2017 23:02
Cambridge application statistics analyser
// ==UserScript==
// @name Cambridge application statistics analyser
// @namespace https://gist.github.com/daniilS/
// @description Go to the application statistics page, select courses or colleges, and press the button!
// @author daniilS
// @version 2
// @updateURL https://gist.github.com/daniilS/0eb8ea9130822b1ff7c4eef64b53f2f5/raw/cambridge_stats.user.js
// @match http://www.undergraduate.study.cam.ac.uk/apply/statistics
// @require https://code.highcharts.com/highcharts.js
// @require https://code.highcharts.com/modules/exporting.js