Skip to content

Instantly share code, notes, and snippets.

View mnanchev's full-sized avatar

Martin Nanchev mnanchev

View GitHub Profile
@mnanchev
mnanchev / kubedf
Created June 16, 2022 13:34 — forked from redmcg/kubedf
Bash script to show k8s PVC usage
#!/usr/bin/env bash
NODESAPI=/api/v1/nodes
function getNodes() {
kubectl get --raw $NODESAPI | jq -r '.items[].metadata.name'
}
function getPVCs() {
jq -s '[flatten | .[].pods[].volume[]? | select(has("pvcRef")) | '\
@mnanchev
mnanchev / NotesApp.swift
Created May 28, 2022 10:08 — forked from jnewc/NotesApp.swift
A notes app written in >100 lines of swift using SwiftUI
import SwiftUI
let dateFormatter = DateFormatter()
struct NoteItem: Codable, Hashable, Identifiable {
let id: Int
let text: String
var date = Date()
var dateText: String {
dateFormatter.dateFormat = "MMM d yyyy, h:mm a"
Method 1 – Using /etc/environment - Set up http proxy permanently using /etc/environment
======================================================================
http_proxy="http://myproxy.server.com:8080/"
https_proxy="http://myproxy.server.com:8080/"
ftp_proxy="http://myproxy.server.com:8080/"
no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com"
HTTP_PROXY="http://myproxy.server.com:8080/"
HTTPS_PROXY="http://myproxy.server.com:8080/"
FTP_PROXY="http://myproxy.server.com:8080/"
NO_PROXY="localhost,127.0.0.1,localaddress,.localdomain.com"
@mnanchev
mnanchev / prettify.py
Created February 10, 2022 19:20 — forked from danlindow/prettify.py
lambda function to make a pretty SNS notification instead of JSON
#!/usr/bin/env python
from __future__ import print_function
import boto3
print('Loading function')
#set region
REGION = 'us-west-2'
#set the SNS topic ARN you want to alert on
SNS_TOPIC_ARN = 'arn:aws:sns:REGION:ACCOUNT_ID:TOPIC_NAME'
exports.handler = async (event, context, callback) => {
const request = event.Records[0].cf.request;
const headers = request.headers;
const user = 'YOUR_USERNAME_HERE';
const pass = 'YOUR_PASSWORD_HERE';
const basicAuthentication = 'Basic ' + new Buffer(user + ':' + pass).toString('base64');
import boto3
import os
import datetime
"""
This portion will obtain the Environment variables from AWS Lambda.
"""
GROUP_NAME = os.environ['GROUP_NAME']