Skip to content

Instantly share code, notes, and snippets.

@x86nick
x86nick / agent.py
Created February 23, 2023 06:18 — forked from wiseman/agent.py
Langchain example: self-debugging
from io import StringIO
import sys
from typing import Dict, Optional
from langchain.agents import load_tools
from langchain.agents import initialize_agent
from langchain.agents.tools import Tool
from langchain.llms import OpenAI
@x86nick
x86nick / README.md
Created May 11, 2020 06:30 — forked from Eyjafjallajokull/README.md
AWS EBS - Find unused snapshots

This script can help you find and remove unused AWS snapshots and volumes.

There is hardcoded list of regions that it searches, adjust the value to suit your needs.

Use snapshot.py snapshot-report to generate report.csv containing information about all snapshots.

snapshot.py snapshot-cleanup lets you interactively delete snapshot if it finds it is referencing unexisting resources.

./snapshots.py --help
@x86nick
x86nick / template.yaml
Created December 10, 2019 19:35 — forked from danilop/template.yaml
Sample AWS SAM Template using Provisioned Concurrency with Application Auto Scaling
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
Sample SAM Template using Application Auto Scaling + Provisioned Concurrency
Globals:
Function:
Timeout: 30
@x86nick
x86nick / go-shebang-story.md
Created November 8, 2019 16:50 — forked from posener/go-shebang-story.md
Story: Writing Scripts with Go

Story: Writing Scripts with Go

This is a story about how I tried to use Go for scripting. In this story, I’ll discuss the need for a Go script, how we would expect it to behave and the possible implementations; During the discussion I’ll deep dive to scripts, shells, and shebangs. Finally, we’ll discuss solutions that will make Go scripts work.

Why Go is good for scripting?

While python and bash are popular scripting languages, C, C++ and Java are not used for scripts at all, and some languages are somewhere in between.

@x86nick
x86nick / ..README.md
Created July 19, 2019 17:10 — forked from joncalhoun/..README.md
Most of my settings for a new mac

Chrome

  • Download & install Chrome
  • Login & sync settings/whatever else

Mac OS settings

  • General -> Use dark menu bar
  • General -> Default web browser: Google Chrome
@x86nick
x86nick / get-image-config.sh
Created July 18, 2019 03:06 — forked from cirocosta/get-image-config.sh
Retrieves the configuration of images pushed to Docker registries - see https://ops.tips/blog/inspecting-docker-image-without-pull/ for more information
#!/bin/bash
# Retrieves image configuration using
# private registries without authentication
set -o errexit
# Address of the registry that we'll be
# performing the inspections against.
# This is necessary as the arguments we
@x86nick
x86nick / delete-ami
Created April 20, 2019 04:32 — forked from elasticdog/delete-ami
Deregister an Amazon Machine Image (AMI) and delete its corresponding root device snapshot
#!/usr/bin/env bash
#
# delete-ami
#
# A script to deregister an Amazon Machine Image (AMI) and
# delete its corresponding root device snapshot.
#
##### Functions
@x86nick
x86nick / cross-compile.sh
Created February 28, 2019 17:00 — forked from bmuschko/cross-compile.sh
Go binary cross-compilation script
#!/usr/bin/env bash
HASH="$(git rev-parse --short HEAD)"
NAME="link-verifier"
VERSION="0.4"
DATE=$(date +%d-%m-%Y" "%H:%M:%S)
BUILD_DIR="build"
BUILD_TMP_DIR="$BUILD_DIR/tmp/$NAME-$VERSION"
BUILD_BIN_DIR="$BUILD_DIR/binaries"
BUILD_NIX_BIN_FILE="$BUILD_TMP_DIR/$NAME"
@x86nick
x86nick / heredoc-dockerfile.snip
Created September 7, 2018 05:03 — forked from abn/heredoc-dockerfile.snip
Dockerfile alternatives for heredoc
#printf
RUN printf '#!/bin/bash\n\
echo hello world from line 1\n\
echo hello world from line 2'\
>> /tmp/hello
#echo
RUN echo -e '#!/bin/bash\n\
echo hello world from line 1\n\
echo hello world from line 2'\
@x86nick
x86nick / exercise.tour.go
Created August 21, 2018 14:30 — forked from zyxar/exercise.tour.go
tour.golang exercise solutions
/* Exercise: Loops and Functions #43 */
package main
import (
"fmt"
"math"
)
func Sqrt(x float64) float64 {
z := float64(2.)