Skip to content

Instantly share code, notes, and snippets.

View nym3r0s's full-sized avatar
👋

Gokul Srinivas nym3r0s

👋
View GitHub Profile
@nym3r0s
nym3r0s / clean_index_datetime_format.py
Created October 1, 2021 09:40
Script to clean up time formats in elastic indexes
import requests
import datetime
import json
script_string = '''
DateTimeFormatter formatterNew = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
try {
ZonedDateTime zonedDateTime1 = ZonedDateTime.parse(ctx._source.creationTime, formatterNew);
} catch (DateTimeParseException d) {
@nym3r0s
nym3r0s / vim.log
Created March 30, 2017 17:42
vim startup time
times in msec
clock self+sourced self: sourced script
clock elapsed: other lines
000.008 000.008: --- VIM STARTING ---
000.118 000.110: Allocated generic buffers
000.424 000.306: locale set
000.429 000.005: clipboard setup
@nym3r0s
nym3r0s / mis.js
Created November 13, 2016 13:52
MIS feedback for NITT students
(function() {
var _old_alert = window.alert;
window.alert = function() {
_old_alert.apply(window,arguments);
var d = parent.frames['main'].document;
d.getElementById('Button3').click();
};
})();
@nym3r0s
nym3r0s / .nvimrc
Created May 17, 2016 12:59
My .nvimrc for Neovim
filetype off " required
call plug#begin('~/.config/nvim/plugged')
Plug 'Raimondi/delimitMate'
Plug 'jiangmiao/auto-pairs'
Plug 'flazz/vim-colorschemes'
Plug 'chriskempson/base16-vim'
Plug 'tpope/vim-fugitive'
Plug 'matze/vim-move'
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
@nym3r0s
nym3r0s / timehack.sh
Created January 12, 2016 09:42
Update the time in linux
sudo date -s "$(wget -qSO- --max-redirect=0 google.com 2>&1 | grep Date: | cut -d' ' -f5-8)Z"
@nym3r0s
nym3r0s / install_vim.sh
Last active June 3, 2021 10:12
Installs nym3r0s/vimrc as your vim installation
cd ~;
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
wget https://raw.githubusercontent.com/nym3r0s/vimrc/master/.vimrc
vim -c "PlugInstall"
cd -;
@nym3r0s
nym3r0s / filegetter.js
Last active November 23, 2016 09:43
JS snippet to get all the links to files of any extension from a webpage
var asdf = document.getElementsByTagName("a");
var asdfext = ".pdf";
for(var asdfinc =0 ; asdfinc < asdf.length;asdfinc++){
if(asdf[asdfinc].href.indexOf(asdfext)!=-1){
console.log(asdf[asdfinc].href);
}
}
@nym3r0s
nym3r0s / .gitignore
Created November 21, 2015 13:07
gitignore for directory with only cpp files
# Ignore all
*
# Unignore all with extensions
!*.*
# Unignore all dirs
!*/
### Above combination will ignore all files without extension ###
@nym3r0s
nym3r0s / mp3convert.sh
Created October 13, 2015 17:52
Convert every file in the directory to mp3 and move it to a subdirectory called mp3
for a in *.*; do
name=$(echo $a | cut -f 1 -d '.')
name=${name// /-}
dir="/mp3/"
ext=".mp3"
name=$name$ext
ffmpeg -i "$a" -qscale:a 0 "$name"
done
mkdir mp3;