Skip to content

Instantly share code, notes, and snippets.

@Venkat-Swaraj
Venkat-Swaraj / PointCloudParser.cs
Created June 25, 2024 18:05
This script can be used to save point cloud data.
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.XR.ARFoundation;
public class PointCloudParser : MonoBehaviour
{
public ARPointCloudManager pointCloudManager;
private void OnEnable()
{
pointCloudManager.pointCloudsChanged += PointCloudManager_pointCloudsChanged;
}
@Venkat-Swaraj
Venkat-Swaraj / Countdown
Created August 25, 2023 06:01
Countdown timer using Coroutine in Unity
private float currCountdownValue = 0;
public IEnumerator StartCountdown(float countdownValue = 10) {
currCountdownValue = countdownValue;
while (currCountdownValue > 0) {
Debug.Log("Countdown: " + currCountdownValue);
yield return new WaitForSeconds(1.0f);
currCountdownValue--;
}
}
@Venkat-Swaraj
Venkat-Swaraj / findIPaddress.cs
Created August 25, 2023 05:57
To find IP address of a player in unity.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
public class findIPaddress : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
@Venkat-Swaraj
Venkat-Swaraj / ll.c
Last active September 29, 2022 03:47
Linked List
#include <stdio.h>
#include <stdlib.h>
typedef struct stud{
int roll;
char name[25];
int age;
struct stud *next;
}node;
@Venkat-Swaraj
Venkat-Swaraj / CardboardSetup.cs
Created July 20, 2022 06:29
Cardboard setup (For cross button and settings button to work you need to use this script)
// Add an empty gameobject to the scene and simple add this script to the gameobject by clicking add component and locate this script
// Or create a new script and paste the below code into it.
using System.Collections;
using Google.XR.Cardboard;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.XR;
using UnityEngine.XR.Management;
@Venkat-Swaraj
Venkat-Swaraj / runnerup.py
Created July 9, 2022 05:03
HackerRank(Find the Runner-up score)
'''
Given the participants' score sheet for your University Sports Day, you are required to find the
runner-up score. You are given n scores. Store them in a list and find the score of the runner-up.
Input Format
The first line contains n. The second line contains an array A[] of n integers each separated
by a space.
Output Format
def category_dict(filename):
# Write your logic here
dictionary = {}
fp = open(filename,'r')
names = fp.readlines()
for name in names:
words = name.split(' ')
words[1] = words[1].strip('\n')
if words[1] in dictionary:
"""
Remove all one-line comments,
a comment which starts and ends on one line
Example
Input:
# This is a comment
print('remove_comments')
Output:
@Venkat-Swaraj
Venkat-Swaraj / instructions.txt
Created May 7, 2022 10:00
Timer problem in Python
program in the file observe.py that prints out the calls for a spaceship that is about to launch. Countdown from 10 to 1 and then output Liftoff!
Your uses a for loop.
Here's a sample run of the program:
$ python3 Observe.py
10
9
8
@Venkat-Swaraj
Venkat-Swaraj / Instructions.txt
Created May 7, 2022 09:55
sum guesser problem
program in the file Observe.py that prints 10 random integers (each random integer should have a value between 0 and 100, inclusive).
program uses a constant named NUM_RANDOM, which determines the number of random numbers to print (with a value of 10).
It also uses constants named MIN_RANDOM and MAX_RANDOM to determine the minimal and maximal values of the random numbers generated (with respective values 0 and 100).
To generate random numbers, you should use the function random.randint() from Python’s random library.
Here's a sample run of the program: