Skip to content

Instantly share code, notes, and snippets.

View sanketsudake's full-sized avatar

Sanket Sudake sanketsudake

View GitHub Profile
@volkansalma
volkansalma / gist:1170793
Created August 25, 2011 14:29
OpenCV 2.3 ile Optical Flow C++
#include <opencv2/opencv.hpp>
#include <iostream>
#include <vector>
#include <cmath>
using namespace cv;
using namespace std;
int main(int argc, char** argv)
{
@toolness
toolness / gencert.py
Last active June 22, 2023 11:52
Python script to create server SSL certs and sign them with a custom CA.
#! /usr/bin/python
"""
This simple script makes it easy to create server certificates
that are signed by your own Certificate Authority.
Mostly, this script just automates the workflow explained
in http://www.tc.umn.edu/~brams006/selfsign.html.
Before using this script, you'll need to create a private
@aymanfarhat
aymanfarhat / Intersection.py
Created January 4, 2013 19:52
Set Intersection algorithm O(nlogn) time. Code in Python.
from itertools import chain
intersection = []
sets = [[0,4,5,2,1],[1,3,6,2,4],[4,1,2,5,7,0]]
merged = list(chain.from_iterable(sets))
merged.sort()
require 'ripper'
require 'pp'
code =<<STR
10.times do |n|
puts n
end
STR
puts code
@simonw
simonw / recover_source_code.md
Last active May 30, 2024 00:39
How to recover lost Python source code if it's still resident in-memory

How to recover lost Python source code if it's still resident in-memory

I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6

Attach a shell to the docker container

Install GDB (needed by pyrasite)

apt-get update && apt-get install gdb
@sanketsudake
sanketsudake / boto3_assume_role.py
Last active February 22, 2019 21:43
Assume role for AWS cross-account with boto 3
import logging
import boto3
import dateutil
logger = logging.getLogger()
logger.addHandler(logging.StreamHandler()) # Writes to console
logger.setLevel(logging.INFO)
def create_sts_client(aws_access_key_id=None,
@amukherj
amukherj / client.go
Last active April 21, 2021 12:50
HTTPS with client authentication using Go
package main
// Code copied from open source repos and customized
import (
"crypto/tls"
"crypto/x509"
"flag"
"io/ioutil"
@janjaali
janjaali / docker-postgres-snapshot.md
Last active May 31, 2024 15:27
Snapshot instruction for dockerized postgres

Create snapshot of dockerized postgres

The goal of this instruction is to enable users to create Docker images that contain a predefined postgres instance with existing schema and data. We will use the official docker postgres image and mostly docker's own commands.

The first step is to setup a docker container running postgres containing t# Create snapshot of dockerized postgres

The goal of this instruction is to enable users to create Docker images that contain a predefined postgres instance with existing schema and data. We will use the official docker postgres image and mostly docker's own commands.

The first step is to setup a docker container running postgres containing the schema and data that we want to include in the created snapshot:

@sanketsudake
sanketsudake / kind-kubernetes-metrics-server.md
Last active April 5, 2024 07:06
Running metric-server on Kind Kubernetes

I have created a local Kubernetes cluster with kind. Following are changes you need to get metric-server running on Kind.

Deploy latest metric-server release.

kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/download/v0.5.0/components.yaml

Within existing arguments to metric-server container, you need to add argument --kubelet-insecure-tls.

@veekaybee
veekaybee / normcore-llm.md
Last active June 1, 2024 03:03
Normcore LLM Reads

Anti-hype LLM reading list

Goals: Add links that are reasonable and good explanations of how stuff works. No hype and no vendor content if possible. Practical first-hand accounts of models in prod eagerly sought.

Foundational Concepts

Screenshot 2023-12-18 at 10 40 27 PM

Pre-Transformer Models