Skip to content

Instantly share code, notes, and snippets.

@tjumyk
tjumyk / .bashrc
Created September 25, 2017 09:21
Python virtual environment manipulation functions for BASH
# follow other existing lines
# manipulation of virtual environments
venv()
{
local venv_home
if [ -z $1 ]; then
if [ -d ".venv" ]; then
if [ -L ".venv" ]; then
venv_home=$(readlink -f ".venv")
@tjumyk
tjumyk / install_dev_tools.bash
Created September 22, 2015 02:08
A simple bash script for installing essential packages for a quick start of development on a brand new Ubuntu OS
#!/usr/bin/env bash
##############################
# Add sources
##############################
# google chrome stable
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
@tjumyk
tjumyk / xmlToJson.js
Created April 8, 2013 16:51
A modified version of the xmlToJson function from http://davidwalsh.name/convert-xml-json, it removes the useless whitespace strings and extract attributes as normal properties so as to make the json simpler and tidier. Only for personal convenience, any ideas?
// Changes XML to JSON
function xmlToJson(xml) {
// Create the return object
var obj = {};
if (xml.nodeType == 1) { // element
// do attributes
if (xml.attributes.length > 0) {
//obj["attributes"] = {};