Skip to content

Instantly share code, notes, and snippets.

View bsurnida's full-sized avatar

Bhasker Surnida bsurnida

  • Oracle Corporation
  • Redwood Shored, San Francisco, CA.
View GitHub Profile
@amejiarosario
amejiarosario / ngTodos.html
Last active March 1, 2018 08:28
angularJS routes todo app
<html ng-app="app">
<head>
<title>Hello Controllers in AngularJS</title>
</head>
<body>
<ng-view></ng-view>
<!-- Libraries -->
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.25/angular.min.js"></script>
@ashrithr
ashrithr / readme.md
Last active January 14, 2025 07:49
Installing ELK on a single machine

Installing ELK (CentOS)

This is a short step-by-step guide on installing ElasticSearch LogStash and Kibana Stack on a CentOS environment to gather and analyze logs.

I. Install JDK

rpm -ivh https://dl.dropboxusercontent.com/u/5756075/jdk-7u45-linux-x64.rpm
@huskercane
huskercane / python_java_time.py
Created July 29, 2014 15:08
Convert from java timestamp to python datetime and vice versa
def _convert_java_millis(java_time_millis):
"""Provided a java timestamp convert it into python date time object"""
ds = datetime.datetime.fromtimestamp(
int(str(java_time_millis)[:10])) if java_time_millis else None
ds = ds.replace(hour=ds.hour,minute=ds.minute,second=ds.second,microsecond=int(str(java_time_millis)[10:]) * 1000)
return ds
def _convert_datetime_java_millis(st):
"""Provided a python datetime object convert it into java millis"""
@rshk
rshk / kibana-apache-logs.json
Created May 6, 2014 16:16
Kibana: analyze Apache logs
{
"title": "Apache logs",
"services": {
"query": {
"list": {
"0": {
"query": "*",
"alias": "",
"color": "#7EB26D",
"id": 0,
@bugcy013
bugcy013 / logstach Examples
Created April 26, 2014 00:09
logstach Examples collection
Example -1
=====================
input {
file {
path => [ "/usr/local/var/log/suricata/eve.json", "/var/log/ulogd.json" ]
codec => json
type => "json-log"
}
}
@kevin-smets
kevin-smets / iterm2-solarized.md
Last active April 19, 2025 04:48
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@mmaassen
mmaassen / weblogic-shipper.conf
Last active May 11, 2019 16:31
LogStash (1.2.2) WebLogic Server shipper
input {
## WebLogic Server Log
file {
type => "weblogic"
path => [ "/var/log/weblogic/domain/managedserver.log" ]
codec => multiline {
pattern => "^####"
negate => true
what => previous
}
def verify_sign(public_key_loc, signature, data):
'''
Verifies with a public key from whom the data came that it was indeed
signed by their private key
param: public_key_loc Path to public key
param: signature String signature to be verified
return: Boolean. True if the signature is valid; False otherwise.
'''
from Crypto.PublicKey import RSA
from Crypto.Signature import PKCS1_v1_5
def sign_data(private_key_loc, data):
'''
param: private_key_loc Path to your private key
param: package Data to be signed
return: base64 encoded signature
'''
from Crypto.PublicKey import RSA
from Crypto.Signature import PKCS1_v1_5
from Crypto.Hash import SHA256
from base64 import b64encode, b64decode
@miguelgrinberg
miguelgrinberg / rest-server.py
Last active February 12, 2025 21:09
The code from my article on building RESTful web services with Python and the Flask microframework. See the article here: http://blog.miguelgrinberg.com/post/designing-a-restful-api-with-python-and-flask
#!flask/bin/python
from flask import Flask, jsonify, abort, request, make_response, url_for
from flask_httpauth import HTTPBasicAuth
app = Flask(__name__, static_url_path = "")
auth = HTTPBasicAuth()
@auth.get_password
def get_password(username):
if username == 'miguel':