Skip to content

Instantly share code, notes, and snippets.

View jdvala's full-sized avatar

Jay Vala jdvala

View GitHub Profile
@jdvala
jdvala / git-tree.md
Created May 18, 2021 14:33
git tree

alias git-tree='git log --oneline --decorate --all --graph'

@jdvala
jdvala / .vimrc
Created April 23, 2021 11:32 — forked from simonista/.vimrc
A basic .vimrc file that will serve as a good template on which to build.
" Don't try to be vi compatible
set nocompatible
" Helps force plugins to load correctly when it is turned back on below
filetype off
" TODO: Load plugins here (pathogen or vundle)
" Turn on syntax highlighting
syntax on
@jdvala
jdvala / killed.md
Created April 22, 2021 11:19
what killed my process

dmesg -T| grep -E -i -B100 'killed process'

@jdvala
jdvala / show_mem.md
Created April 22, 2021 11:18
who is using resources
#!/bin/bash

stats=””
echo "%   user"
echo "============"

# collect the data
for user in `ps aux | grep -v COMMAND | awk '{print $1}' | sort -u`
do
@jdvala
jdvala / jq_jsonl_conversion.md
Created September 29, 2020 11:14 — forked from sloanlance/jq_jsonl_conversion.md
jq: JSONL ↔︎ JSON conversion

jq: JSONL ↔︎ JSON conversion

  1. JSONL → JSON

    jq -s '.' input.jsonl > output.json
  2. JSON → JSONL

jq -c '.[]' input.json > output.jsonl

@jdvala
jdvala / health.md
Last active May 6, 2021 06:39
commands to keep you sit straight

The script below will allow you to run gui programs from crontab

usage: * * * * /path/to/belowcode.sh "gui application"
#!/bin/bash                                                                                                                                                                                                                                

# Check whether the user is logged in Mate
@jdvala
jdvala / test_mock.py
Created June 12, 2020 09:39 — forked from tomschr/test_mock.py
Example of mocking os.path.isfile
#!/usr/bin/env python3
#
# Use py.test:
# $ py.test test_mock.py
from unittest.mock import patch
import os.path
def my_isfile(filename):
@jdvala
jdvala / custom_func.md
Last active February 8, 2020 13:41
Manage python virtual environments

Custom function for python virtual environment

# create a new directory for all your virtual environments, preferably in your home folder
mkidr environments

Add the below function to your bashrc or zshrc

create_venv(){
 # check if folder exist
@jdvala
jdvala / stateful_lstm_embedding.py
Created February 1, 2019 16:01 — forked from stefanthaler/stateful_lstm_embedding.py
Simple example for a stateful keras LSTM with embedding.
"""
Learning Task:
Given a sequence, predict a label based on the first value of the sequence
Explanation of stateful LSTM and setup:
http://philipperemy.github.io/keras-stateful-lstm/
Exmple:
given a sequence [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], predict 1
given a sequence [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], predict 0