Skip to content

Instantly share code, notes, and snippets.

from google.auth.transport.requests import Request
from google.cloud import storage
import os
# Set up proxy configuration
os.environ['HTTP_PROXY'] = "http://username:password@proxyserver:port"
os.environ['HTTPS_PROXY'] = "https://username:password@proxyserver:port"
# Create a custom request object with proxy
auth_request = Request()
@stacklikemind
stacklikemind / hashing.py
Created March 18, 2024 17:07
hashing csv
import pandas as pd
import hashlib
# Define the hashing function using SHA-256
def hash_value(value):
# Ensure the value is a string
value = str(value)
return hashlib.sha256(value.encode()).hexdigest()
# Load the CSV file into a DataFrame
- name: Get current timestamp
ansible.builtin.shell: "date '+%Y-%m-%d_%H-%M-%S'"
register: current_time
import asyncio
import aiohttp
from aiohttp import web
import aioconsole
import logging
logging.basicConfig(level=logging.INFO)
# Global variable to toggle
toggle_state = False
import os
import json
from confluent_kafka import Producer
import random
from faker import Faker
from jinja2 import Template
import sys
fake = Faker()
import logging
import time
import aiohttp
from aiohttp import web
# Configure logging to print to stdout
logging.basicConfig(level=logging.INFO)
async def handle_post(request):
# Record the start time
python -c "from http.server import HTTPServer, BaseHTTPRequestHandler; import logging; logging.basicConfig(level=logging.INFO); HTTPServer(('', 8000), type('Handler', (BaseHTTPRequestHandler,), {'do_POST': lambda self: [self.send_response(200), self.end_headers(), self.wfile.write((data := self.rfile.read(int(self.headers.get('Content-Length'))))), logging.info(f'Received data: {data.decode()}')]})).serve_forever()"
@stacklikemind
stacklikemind / golan_getrows.go
Created November 10, 2023 21:22
golan_getrows.go
package main
import (
"database/sql"
"encoding/csv"
"fmt"
"os"
_ "github.com/lib/pq" // or the driver of your choice
)
@stacklikemind
stacklikemind / Aad.go
Last active November 10, 2023 19:48
golang Aad token
package main
import (
"context"
"fmt"
"golang.org/x/oauth2/clientcredentials"
)
func main() {
// Define your Service Principal credentials
graph TB
A[Create feature branch on VM] --> B[Add changes]
B --> C[Increment version number]
C --> D[Commit & Push]
D --> E{Does a release already exist?}
E -->|Yes| F[Update artifact version]
E -->|No| G[Create a new release and attach the right artifacts and version]
F --> H[Deploy the release for the DEV environment]
G --> H
H --> I[Implement the release in DEV]