Skip to content

Instantly share code, notes, and snippets.

@AlmogBaku
AlmogBaku / landing_page_gen.py
Created July 30, 2024 11:50
The example of the Prompt Engineering Tips article
# This snippet is used as an example for the Prompt Engineering Tips article
# The code was partially generated, and NOT PRODUCTION READY at any level. It's written in a way that shows the point
# of each tip, and the prompts are actually bad (even though they are functional, and for a prompt engineering tips
# article; lol)
#
# It should be seen as a pseudocode, and not as a final implementation, production code will require carefully
# SOP modeling, and a much more detailed process
#
# The goal is to give you a high-level perspective of the Tips detailed in the article, for readers who need to see
# "the whole picture" to understand the concept
@AlmogBaku
AlmogBaku / MediumConverter.py
Last active August 14, 2024 19:02
Medium to Markdown
import mimetypes
import os
import markdownify
import requests
mimetypes.init()
class MediumConverter(markdownify.MarkdownConverter):
@AlmogBaku
AlmogBaku / install-new-env.md
Last active September 26, 2024 07:21
New environment

Installations required on a new environment

  1. Install Bitwarden from App Store
  2. Install brew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  1. Install Xcode Command Line Tools
    1.  xcode-select --install
@AlmogBaku
AlmogBaku / README.md
Last active October 17, 2021 19:39
Filter OpenAPI JSON by tags

Usage

node filter.js <swagger.json> <tags,seperated,by,commas>

How does it work?

  1. Iterate over the ".paths"
  2. If has relevant tag, keep it. Otherwise, delete it
  3. For relevant paths: recursively fetch for references
  4. Recurcively look for references in the "definitions", and build a complete reference map
@AlmogBaku
AlmogBaku / encoder.go
Created October 9, 2021 09:50
Sarama protobuf encoder
package protoencoder
import (
"github.com/Shopify/sarama"
"google.golang.org/protobuf/proto"
)
type encoder struct {
msg proto.Message
}
@AlmogBaku
AlmogBaku / bitly.go
Last active May 8, 2024 15:36
Golang Bitly: simple, stupid shortener written in go
package bitly
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
const BaseURL = "https://api-ssl.bitly.com/v4"
@AlmogBaku
AlmogBaku / new_es_schema.json
Created September 23, 2016 20:27
New ElasticSearch Sink schema
{
"heapster-2016.09.23": {
"aliases": {
"heapster-cpu-2016.09.23": { },
"heapster-events-2016.09.23": { },
"heapster-filesystem-2016.09.23": { },
"heapster-general-2016.09.23": { },
"heapster-memory-2016.09.23": { },
"heapster-network-2016.09.23": { }
},
@AlmogBaku
AlmogBaku / main.go
Created May 21, 2016 12:05
Sample HTTP Server written in Go
ackage main
import (
"fmt"
"io"
"net/http"
)
func hello(w http.ResponseWriter, r *http.Request) {
io.WriteString(w, "Hello world!")
@AlmogBaku
AlmogBaku / leveledlogger.go
Last active May 18, 2016 23:23
LeveledLogger
package leveledlogger
import (
"github.com/go-kit/kit/log"
)
type LogLevel int
const (
Off LogLevel = iota
@AlmogBaku
AlmogBaku / order_ps_res.sh
Last active December 30, 2015 12:05
Order photoshop exported resources for android
#!/bin/bash
res_organize() {
res_dir=$1
res_suffix=$2
if [ ! -d "./${res_dir}" ]; then
mkdir ./${res_dir}
fi;