Skip to content

Instantly share code, notes, and snippets.

View tusqasi's full-sized avatar

Tushar Kuntawar tusqasi

View GitHub Profile
#!/data/data/com.termux/files/usr/bin/bash
cd $(dirname $0)
## unset LD_PRELOAD in case termux-exec is installed
unset LD_PRELOAD
command="proot"
command+=" --link2symlink"
command+=" -0"
command+=" -r ubuntu-fs"
if [ -n "$(ls -A ubuntu-binds)" ]; then
for f in ubuntu-binds/* ;do
@tusqasi
tusqasi / 2_april_2022.md
Last active April 2, 2022 19:54
Vatsalya meet points

Tasks Done

  • Box collection

  • Paper uploading

    • Done
  • Email

  • FY question paper, analysis.

  • Box placement

    • FY done by monday
# question 1
from random import randint, seed
def disp_fraction(f: list):
return f"{' ' if f[0] == 0 else f[0]} {f[1]}/{f[2]}"
def main(ans: tuple[int, int, int]):
opts = []
from itertools import permutations, combinations_with_replacement
def and_g(a: bool, b: bool) -> bool:
return a and b
def or_g(a: bool, b: bool) -> bool:
return a or b
@tusqasi
tusqasi / installation.sh
Created September 14, 2022 03:16
Elixir and erlang installation for eyantra
sudo apt-get install build-essential git wget libssl-dev libreadline-dev libncurses5-dev zlib1g-dev m4 curl wx-common libwxgtk3.0-dev autoconf libxml2-utils xsltproc fop unixodbc unixodbc-bin unixodbc-dev
# installation of asdf
cd
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.7.4
# For Ubuntu or other linux distros
echo '. $HOME/.asdf/asdf.sh' >> ~/.bashrc
echo '. $HOME/.asdf/completions/asdf.bash' >> ~/.bashrc
@tusqasi
tusqasi / primes.ex
Created September 14, 2022 15:53
A prime process with client
# Run with
# $ iex primes.ex
# > Client.start
defmodule Primes do
def is_prime(n) when n == 2 or n == 1 do
true
end
def is_prime(n) when n > 2 do
@tusqasi
tusqasi / functions_test.ex
Last active September 14, 2022 16:09
Useful Enum functions
final_val = Enum.reduce([10, 22, 84], 0, fn(x, acc) -> x + acc end)
# acc takes the value of the return of function passed to Enum.reduce
# `here fn(x,acc) -> x + acc` is the function
# 1
# fn(10, 0) returns 10
# 2
# fn(22, 10) returns 32
# 3
# fn(84, 32) returns 116
@tusqasi
tusqasi / Stacks.c
Created December 22, 2022 12:57
Just implementing stacks
#include <stdio.h>
#include <stdlib.h>
// array based stack
// stack has a size
// it has a end element pointer. That is pretty much it
typedef enum { F, T } boolean;
typedef struct stack {
let reconnects = 0;
let socket;
function connectWebsocket(url) {
socket = new WebSocket(url);
socket.onmessage = function onmessage_callback(message) {
// recieve messages here
};
socket.onopen = function onopen_callback() {
console.log("Connected to: " + socket.url);
@tusqasi
tusqasi / file_receiver_server.js
Last active April 20, 2023 06:23
Basic server which can receive files over post request
const express = require('express');
const multer = require('multer');
const cors = require('cors');
// const sqlite3 = require("sqlite3").verbose();
const axios = require('axios');
const app = express();
app.use(cors());
// app.use(express.static("uploads"));