Skip to content

Instantly share code, notes, and snippets.

View kube-secrets-parser.rb
#!/usr/bin/ruby
require 'base64'
require 'json'
secrets = JSON.parse STDIN.read
data = secrets['data']
parsed_values = data.map{|(k,v)| [k, Base64.decode64(v) ]}
puts JSON.pretty_generate Hash[parsed_values]
@selvakn
selvakn / letsencrypt.pem
Created Aug 11, 2018 — forked from ntninja/letsencrypt.pem
Let's encrypt certificate chain
View letsencrypt.pem
-----BEGIN CERTIFICATE-----
MIIDSjCCAjKgAwIBAgIQRK+wgNajJ7qJMDmGLvhAazANBgkqhkiG9w0BAQUFADA/
MSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT
DkRTVCBSb290IENBIFgzMB4XDTAwMDkzMDIxMTIxOVoXDTIxMDkzMDE0MDExNVow
PzEkMCIGA1UEChMbRGlnaXRhbCBTaWduYXR1cmUgVHJ1c3QgQ28uMRcwFQYDVQQD
Ew5EU1QgUm9vdCBDQSBYMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
AN+v6ZdQCINXtMxiZfaQguzH0yxrMMpb7NnDfcdAwRgUi+DoM3ZJKuM/IUmTrE4O
rz5Iy2Xu/NMhD2XSKtkyj4zl93ewEnu1lcCJo6m67XMuegwGMoOifooUMM0RoOEq
OLl5CjH9UL2AZd+3UWODyOKIYepLYYHsUmu5ouJLGiifSKOeDNoJjj4XLh7dIN9b
xiqKqy69cK3FCxolkHRyxXtqqzTWMIn/5WgTe1QLyNau7Fqckh49ZLOMxt+/yUFw
@selvakn
selvakn / camera.md
Created May 13, 2017 — forked from gabonator/camera.md
Cheap chinese IP camera with H264 encoding based on Hisilicon 8M (Hi3518E) chip
View camera.md

Cheap chinese IP camera with H264 encoding based on Hisilicon 8M (Hi3518E) chip

Video stream url for VLC/DVR:

  • rtsp://192.168.1.93:554/user=admin&password=&channel=&stream=.sdp?real_stream--rtp-caching=100

Telnet access

  • telnet 192.168.1.10 23
  • Localhost login: root
  • Password: xmhdipc
@selvakn
selvakn / dhcpd.conf
Last active Apr 21, 2019
Forward DHCP events from isc-dhcp-server server
View dhcpd.conf
# Add the following snippet to your dhcpd.conf
commit {
set ClientName = pick-first-value(option fqdn.hostname, option host-name);
set ClientIp = binary-to-ascii(10, 8, ".", leased-address);
set ClientMac = binary-to-ascii(16, 8, ":", substring(hardware, 1, 6));
execute("forward_dhcp_events.py", "commit", ClientName, ClientIp, ClientMac);
}
on release {
View keybase.md

Keybase proof

I hereby claim:

  • I am selvakn on github.
  • I am selvakn (https://keybase.io/selvakn) on keybase.
  • I have a public key ASBtvzv02q_0MZkqzj-EkCJosiX4vPWiuIQmkleugwJA_Qo

To claim this, I am signing this object:

@selvakn
selvakn / elastalert-slack.rb
Created Jul 12, 2015
ElastAlert slack integration
View elastalert-slack.rb
from elastalert.alerts import Alerter, BasicMatchString
import requests
import json
class SlackAlerter(Alerter, BasicMatchString):
required_options = set(['slack_webhook_url'])
def alert(self, matches):
for match in matches:
data = {'text': str(BasicMatchString(self.rule, match)) }
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
@selvakn
selvakn / rhino-handlebars-precompiler.js
Created May 7, 2012
handlebars precompiler for rhino
View rhino-handlebars-precompiler.js
importPackage(java.io);
(function(args) {
var templateFileExtension = 'handlebars',
output = ['// This file is auto-generated and should be ignored from version control.\n'],
console = {
log: print
},
showUsage = function() {
console.log('Usage: java -jar <rhino.jar> rhino-handlebars-compiler.js --handlebars <handlebars library path> --templates <templates directory> --output <output file>');
@selvakn
selvakn / zoneedit_updater.rb
Created Aug 31, 2010
A ruby client to update ip to zoneedit
View zoneedit_updater.rb
#! /usr/bin/ruby
unless ARGV.size >= 3
puts "USAGE: zoneedit_updater.rb username password domain [force [IP]]"
exit
end
USERNAME = ARGV[0]
PASSWORD = ARGV[1]
DOMAIN = ARGV[2]
View my_bash_profile.sh
source ~/.git-completion.bash
export PATH=/Users/selva/.cabal/bin/:/opt/local/bin:/opt/local/sbin:$PATH
export PATH=/usr/local/mysql/bin/:$PATH
if [[ -s /Users/selva/.rvm/scripts/rvm ]] ; then source /Users/selva/.rvm/scripts/rvm ; fi
export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad
export PS_COLOR="0;32"
@selvakn
selvakn / have_cookie_rspec_matcher.rb
Created Jan 29, 2010
Controller rspec matcher for cookies in rails 2.3
View have_cookie_rspec_matcher.rb