Skip to content

Instantly share code, notes, and snippets.

@selvan
selvan / floating_bottom_nav_bar.dart
Last active May 14, 2024 05:34
Floating bottom navbar in Dart
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
void main() {
runApp(MaterialApp(home: HomePage()));
}
class HomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
@selvan
selvan / go_build_cgo_ldflags
Last active April 9, 2023 06:33
GO build with cgo ldflags
go clean -cache
CGO_LDFLAGS="-L/usr/local/Cellar/x264/r3095/lib" go build
@selvan
selvan / mask_pil.py
Created July 22, 2021 17:40
Mask image generation python
## Rectangle mask
size = (1280, 720)
first_half = (size[0]/2, size[1])
second_half = (first_size_half[0]+1, size[1])
mask = Image.new("L", size, 255)
draw = ImageDraw.Draw(mask)
draw.rectangle((second_half[0], 0, size[0], size[1]), fill=0)
mask.save("/tmp/mask.jpg")
@selvan
selvan / VideoEncoder.java
Created March 20, 2021 01:38
rtmppublisher - Drain encoder via call back + Set bitrate on the fly
package com.takusemba.rtmppublisher;
import android.media.MediaCodec;
import android.media.MediaCodecInfo;
import android.media.MediaFormat;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.HandlerThread;
import android.support.annotation.RequiresApi;
@selvan
selvan / CameraFragment.kt
Created March 20, 2021 01:36
Camera2Video - https://github.com/android/camera-samples.git - Draw to OffscreenSurface (eglCreatePbufferSurface)
/*
* Copyright 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@selvan
selvan / ContinuousCapture.java
Created March 20, 2021 01:30
Grafika - Experiment on replacing WindowSurface (eglCreateWindowSurface) with OffscreenSurface (eglCreatePbufferSurface)
/*
* Copyright 2014 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@selvan
selvan / nvm.md
Created February 8, 2021 07:40
Installing, Configuring and Using NVM

Install:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash

Configuration: add below to .bashrc .bash_profile

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
@selvan
selvan / mobile.md
Last active August 20, 2020 16:46
Mobile Course

Mobile

Fundamentals

Login/Registration

Layout

Navigation

Data fetching & management (Redux etc)

Push Notification

Deep linking

Print load path

lua -e "print(package.path)"