Skip to content

Instantly share code, notes, and snippets.

# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/xenial64"
config.vm.network "private_network", ip: "192.168.33.23"
# To access Dashboard from your local workstation you must create a secure channel to your Kubernetes cluster.
@srkama
srkama / whatsapp.py
Created October 18, 2018 15:16 — forked from deepak3081996/whatsapp.py
send whatsapp messages using python
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
def message(to,message=''):
"""this a simple function to send a whatsapp message to your friends
and group using python and selenium an automated tool to parse the HTML
content and to change the properties.
@srkama
srkama / leetcode_edit_distance.cpp
Created September 18, 2018 11:22 — forked from pdu/leetcode_edit_distance.cpp
Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.) You have the following 3 operations permitted on a word: a) Insert a character b) Delete a character c) Replace a character http://leetcode.com/onlinejudge#question_72
#define MAXN 500
int f[MAXN][MAXN];
int dp(int f[MAXN][MAXN], string& word1, string& word2, int n, int m, int k, int t) {
if (k < 0)
return t + 1;
if (t < 0)
return k + 1;
if (f[k][t] != -1)
@srkama
srkama / serialize.py
Created December 13, 2017 10:37 — forked from dolph/serialize.py
Dict to XML serialization
"""
Dict to XML serializer.
The identity API prefers attributes over elements, so we serialize that way
by convention, and TODO(dolph): configure exceptions.
"""
from lxml import etree
@srkama
srkama / jupyter_shortcuts.md
Created November 3, 2017 08:48 — forked from kidpixo/jupyter_shortcuts.md
Keyboard shortcuts for ipython notebook 3.1.0 / jupyter

Toc

Keyboard shortcuts

The IPython Notebook has two different keyboard input modes. Edit mode allows you to type code/text into a cell and is indicated by a green cell border. Command mode binds the keyboard to notebook level actions and is indicated by a grey cell border.

MacOS modifier keys:

  • ⌘ : Command
@srkama
srkama / Biuj-0.js
Created February 2, 2016 11:57 — forked from anonymous/Biuj-0.js
https://repl.it/Biuj/0 created by sri.pgp@gmail.com
pairs = [["A", "T"],["C","G"]]
function pair(str) {
tempArray = [];
for (j=0;j<str.length;j++){
for (i=0;i<pairs.length;i++) {
indexValue = pairs[i].indexOf(str.charAt(j));
if(indexValue==0) {
tempArray.push(pairs[i].slice());
} else if (indexValue == 1) {
pairs[i].reverse();
// Bonfire: Where do I belong
// Author: @srkama
// Challenge: http://www.freecodecamp.com/challenges/bonfire-where-do-i-belong
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function where(arr, num) {
// Find my place in this sorted array.
arr.sort(function(a,b){return a-b;});
for (i=0;i<=arr.length;i++) {
if (num<=arr[i]) {
// Bonfire: Slasher Flick
// Author: @srkama
// Challenge: http://www.freecodecamp.com/challenges/bonfire-slasher-flick?solution=function%20slasher(arr%2C%20howMany)%20%7B%0A%20%20%2F%2F%20it%20doesn%27t%20always%20pay%20to%20be%20first%0A%20%20a%20%3D%20arr.splice(0%2ChowMany)%3B%0A%20%20return%20arr%3B%0A%7D%0A%0Aslasher(%5B1%2C%202%2C%203%5D%2C%202)%3B%0A
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function slasher(arr, howMany) {
// it doesn't always pay to be first
a = arr.splice(0,howMany);
return arr;
}
// Bonfire: Seek and Destroy
// Author: @srkama
// Challenge: http://www.freecodecamp.com/challenges/bonfire-seek-and-destroy?solution=function%20destroyer(arr)%20%7B%0A%20%20%20args%20%3D%20Array.prototype.slice.call(arguments)%3B%0A%20%20%20args.slice(1).forEach(function(e%2Cl%2Ca)%20%7B%0A%20%20%20arr%20%3D%20arr.filter(function(value)%20%7B%0A%20%20%20%20%20%20%20console.log(value%3D%3De)%3B%0A%20%20%20%20%20%20%20return%20(value!%3De)%3B%0A%20%20%20%20%20%7D)%3B%0A%20%20%20%7D)%3B%0A%20%20return%20arr%3B%0A%7D%0A%0Adestroyer(%5B%5B1%2C%202%2C%203%2C%201%2C%202%2C%203%5D%2C%202%2C%203%5D)%3B%0A
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function destroyer(arr) {
args = Array.prototype.slice.call(arguments);
args.slice(1).forEach(function(e,l,a) {
arr = arr.filter(function(value) {
console.log(value==e);
// Bonfire: Falsy Bouncer
// Author: @srkama
// Challenge: http://www.freecodecamp.com/challenges/bonfire-falsy-bouncer?solution=function%20bouncer(arr)%20%7B%0A%20%20%2F%2F%20Don%27t%20show%20a%20false%20ID%20to%20this%20bouncer.%0A%20%20return%20arr.filter(function(value)%20%7B%0A%20%20%20%20return%20value%3Ftrue%3Afalse%3B%0A%20%20%7D)%3B%0A%7D%0A%0Abouncer(%5B7%2C%20%22ate%22%2C%20%22%22%2C%20false%2C%209%5D)%3B%0A
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function bouncer(arr) {
// Don't show a false ID to this bouncer.
return arr.filter(function(value) {
return value?true:false;
});