Skip to content

Instantly share code, notes, and snippets.

Avatar

Vikas v1k45

View GitHub Profile
@v1k45
v1k45 / aria2.py
Last active Oct 5, 2019
Helper class to interact with Aria2 XMLRPC
View aria2.py
from xmlrpc.client import ServerProxy
class Aria2(ServerProxy):
def __init__(self, *args, **kwargs):
url = "http://aria2-host:6800/rpc"
super().__init__(url, *args, **kwargs)
def _ServerProxy__request(self, methodname, params):
params = ("token:rpc_secret_token", *params)
@v1k45
v1k45 / rebase.md
Created Jul 2, 2019
How to handle multi-dependent branch rebases
View rebase.md

Consider three branches:

  • master

  • feature

    • sub-feature

    If due to some changes in master, a conflict arises in feature, the same conflict will also reflect in sub-feature.

    Do this to retain the commit history of feature in sub-feature for seamless branching.

@v1k45
v1k45 / to_json.py
Created Jul 28, 2018
hack to convert js object to json string
View to_json.py
import re
import json
PRIMITIVE_DATA_GROUPER = r"(?P<initiator>\{|)(\s|)(?P<key>\w+):(\"|)(?P<value>(\B|[\w\s:-]+|\w+\((\"|)\w+(\"|)\)|function\(\)\{[\s\w\"\?\=:-]+\}))(\"|)(?P<terminator>,|\}|\},|\s,)"
OBJECT_DATA_GROUPER = r"(?P<key>\w+):(?P<identifier_token>(\{|\[))"
def get_data():
with open("data") as f:
content = f.read()
View .zshrc
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH=/home/vikas/.oh-my-zsh
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="terminalparty"
@v1k45
v1k45 / .vimrc
Created Sep 12, 2017
My VIM config file
View .vimrc
"*****************************************************************************
"" Vim-PLug core
"*****************************************************************************
if has('vim_starting')
set nocompatible " Be iMproved
endif
let vimplug_exists=expand('~/.vim/autoload/plug.vim')
let g:vim_bootstrap_langs = "javascript,python"
@v1k45
v1k45 / tests.py
Last active Mar 24, 2016
tests for checking if issue #24 on django-notify-x is reproducible
View tests.py
from django.test import TestCase
from notify.signals import notify
from notify.models import Notification
from django.contrib.auth.models import User
from .models import Post
class NotificationCreateTestCase(TestCase):
def setUp(self):