Skip to content

Instantly share code, notes, and snippets.

@jayendra13
jayendra13 / help.sh
Created April 27, 2024 04:30
gcloud helpers
# List all the VM for given project
gcloud compute instances list --format="text(name,zone.basename())"
# List all the VM for given project in table format with id
gcloud compute instances list --format="table(id, name,zone.basename())"
# List all the VM get only id for shell processing
gcloud compute instances list --format="csv[no-heading](id)"
# Get service account for given vm
# sample command to capture camera output, makesure ffmpeg is installed
ffmpeg -f video4linux2 -i /dev/video0 -vframes 1 -video_size 640x480 test.jpeg
# To run the same thing inside the docker image
# run docker in privilaged mode with binding appropriate dirs
docker run --privileged \
--mount type=bind,source=/dev,target=/dev \
--mount type=bind,source=/home/fatlady,target=/root \
--rm -it alpine /bin/sh
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=1
#https://itsfoss.com/disable-ipv6-ubuntu-linux/

Since the nix store is immutable and cannot be modified, you need to define a writable location for NPM packages to be installed globally.

Install NodeJS if you haven’t already.

Add the following to your ~/.npmrc to have it put the packages in the ~/.npm-packages folder:

prefix = ${HOME}/.npm-packages

You need to add the npm bin folder to your PATH in your shell’s rc file (i.e. .bashrc or .zshrc for example, so you can access the executables:

package com.brums.app;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
import java.sql.SQLException;
public class App {
public static void main(String[] args) {
module Main where
-- http://files.farka.eu/pub/AC21007/lec5.pdf
insSortImpl :: [Int] -> [Int] -> [Int]
insSortImpl sorted [] = sorted
insSortImpl sorted (x:xs) =
insSortImpl (insert x sorted) xs
where
insert y [] = [y]
#[derive(Debug)]
struct Pipeline {
context: String,
}
impl Pipeline {
fn new(context: String) -> Pipeline {
Pipeline {
context: context,
}
Copyright 2002 jayendra0parmar@gmail.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR TH
# https://www.tifr.res.in/~vahia/tithi-calculations.pdf
import datetime
from astropy.coordinates import get_body
from astropy.time import Time
from astropy.coordinates import EarthLocation
NUM_TITHIS = 15
def get_tithi(timestamp, location):
sun = get_body('sun', timestamp, location)
import ast
import astor
class MyListComp(ast.ListComp):
def __init__(self, target, value):
self._target = target
self._value = value
class MySourceGenerator(astor.SourceGenerator):