Skip to content

Instantly share code, notes, and snippets.

View sumitasok's full-sized avatar

Sumit. M. Asok sumitasok

View GitHub Profile
@sumitasok
sumitasok / k-cm-coredns-kind
Created February 20, 2026 15:56
k-cm-coredns-kind
(venv) ╭─sa001780 at L04M24KMF7 in ~/code/samples/coredns-on-kind-cluster on main✘✘✘ 26-02-20 - 21:24:47
╰─(venv) ⠠⠵ kind create cluster --config kind-config.1.33.1.yaml
Creating cluster "1331" ...
✓ Ensuring node image (kindest/node:v1.33.1) 🖼
✓ Preparing nodes 📦 📦
✓ Writing configuration 📜
✓ Starting control-plane 🕹️
✓ Installing CNI 🔌
✓ Installing StorageClass 💾
✓ Joining worker nodes 🚜
@sumitasok
sumitasok / interfaces__migrator.go
Last active September 9, 2021 03:22
sample of how to do database table creation and deletion for running tests and then cleaning up.
package migration
type Migrator interface {
Migrate() error
}
@sumitasok
sumitasok / mov_to_mp4_convertor.sh
Last active October 19, 2020 08:06
Convert mov files in a folder to mp4 using ffmpeg
# cd to the folder where you have your .mov video files.
find . -name \*.mov -print0 | xargs -0 -I{} ffmpeg -i {} -f mp4 -vcodec libx264 -preset fast -profile:v main -acodec aac -vf scale=1024:576 {}.mp4
@sumitasok
sumitasok / band-info.json
Last active May 20, 2020 04:57
Sample GeoJson
{
'type': 'RGB'
'bandInfo': {
0 : { 'type': '...', 'colorinterpreter': 'R' }
1 : { 'type': '...', 'colorinterpreter': 'G' }
}
'cogInfo': {}
'mapTile': {}
}
@sumitasok
sumitasok / Dockerfile
Created June 16, 2019 07:08 — forked from perrygeo/Dockerfile
Minimal debian image with Python 3.6 and geo python tools
FROM python:3.6-slim-stretch
ADD requirements.txt /tmp/requirements.txt
RUN apt-get update && \
apt-get install -y \
build-essential \
make \
gcc \
locales \
@sumitasok
sumitasok / test.go
Created November 28, 2018 01:39
Golang Test snippet
package models_test
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestMeta_ToJson(t *testing.T) {
assert := assert.New(t)
@sumitasok
sumitasok / class_var3.rb
Last active June 13, 2018 18:39
Understanding the Ruby scopes
# Class variables with @ are accessible from class methods!
class MyClass
@var = 2
def self.square
@var *= @var
end
end
MyClass.square
@sumitasok
sumitasok / ruby-fake-a-web-response
Last active May 17, 2018 12:54
Snippet to fake a web response for testing the response.
req = RestClient::Request.new(url: "www.google.com", method: 'get')
net_http_resp = Net::HTTPResponse.new(1.0, 200, "OK")
net_http_resp.add_field 'Set-Cookie', 'Monster'
resp = RestClient::Response.create(response_body.to_json, net_http_resp, req)
# * 100,000,000-line file generated by seq 100000000 > test.in
# * Reading lines 50,000,000-50,000,010
# * Tests in no particular order
# * real time as reported by bash's builtin time
# https://unix.stackexchange.com/questions/47407/cat-line-x-to-line-y-on-a-huge-file
awk 'NR >= 57890000 && NR <= 57890010' /path/to/file
awk 'NR < 57890000 { next } { print } NR == 57890010 { exit }' /path/to/file
tail -n+50000000 test.in | head -n10
@sumitasok
sumitasok / block-logger.rb
Last active December 6, 2016 10:07
Log batch process
=begin
Usage:
[1, 4, 7, 2, 19].each do |i|
Logging::Block.start(:type, Logging::Logger) do |list|
list.item_with_uuid(i, {i: i}) do |item|
if i < 7
item.success({i: i})
else