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 / jenkins-pipeline
Created September 26, 2020 16:26
Jenkins pipline for python projects
pipeline {
agent {
node {
label 'my_local_server'
customWorkspace '/projects/'
}
}
stages {
stage('Checkout project') {
steps {
@srkama
srkama / url_checker_with_aiohttp.py
Created December 19, 2018 09:57
async url checker with aiohttp
import asyncio
import aiohttp
async def check_website(url_to_ping):
while True:
print("trying {0}".format(url_to_ping))
try:
async with aiohttp.ClientSession() as session:
async with session.get(url_to_ping) as response:
response = await response.text()
@srkama
srkama / async_simple_client.py
Created December 19, 2018 09:54
simple async client accepts the connection
import asyncio
async def tcp_echo_client(message):
reader, writer = await asyncio.open_connection(
'127.0.0.1', 8888)
msg = ""
while msg != 'quit':
msg = input("Please enter message to server: ")
print(f'Send: {msg!r}')
@srkama
srkama / async_simple_server.py
Created December 19, 2018 07:31
simple echo server using asyncio.
import asyncio
async def handle_echo(reader, writer):
while True:
data = await reader.read(100)
message = data.decode()
addr = writer.get_extra_info('peername')
print(f"Received {message!r} from {addr!r}")
@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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<script src="https://unpkg.com/vue"></script>
</head>
<body>
<div id="app">