Skip to content

Instantly share code, notes, and snippets.

View rlingineni's full-sized avatar
💭
building cool stuff

Raviteja Lingineni rlingineni

💭
building cool stuff
View GitHub Profile
@rlingineni
rlingineni / changeCalc.cpp
Created September 20, 2015 18:14
ChangeCalculator Program C++
#include <iostream>
#include <math.h>
using namespace std;
int main() {
//reads from input file, or takes user input. 1st is your total amount, and the second is how much you paid
double total;
//get change
cin >>total;
.data
str: .space 23 # buffer for input string
strNS: .space 23 # buffer for string w/o spaces
prompt: .asciiz "Enter a string up to 80 characters\n"
head1: .asciiz "\nOriginal String: "
head2: .asciiz "\nNumber of spaces: "
head3: .asciiz "\nWith spaces removed: "
head4: .asciiz "\nSeparated: "
endOfFileLine: .asciiz ".end"
@rlingineni
rlingineni / file update config function
Created November 23, 2016 20:07
Raspberry Pi Wifi Config update function
console.log("Updating Wifi to SSD: " + SSID);
var data = fs.readFileSync('/etc/wpa_supplicant/wpa_supplicant.conf', 'utf8');
var result = data.replace(/ssid="(.*)"/g, 'ssid="'+ SSID + '"');
var finalResult = result.replace(/psk="(.*)"/g, 'psk="'+ Password + '"');
console.log("Will print: \n" + finalResult); //this prints out correctly, finalResult holds what I want it ot
//need to fix writing to file (only writes like a piece of it)
fs.writeFile('/etc/wpa_supplicant/wpa_supplicant.conf', finalResult, 'utf8', function (err) {
@rlingineni
rlingineni / gist:54f16329ecb5206ad3bf769a762deb42
Created December 21, 2016 21:45
Hashtag Detection Xamarin.Forms
void Handle_MessageChanged(object sender, TextChangedEventArgs e)
{
Editor editor = sender as Editor;
string val = editor.Text; //Get Current Text
if (val.Length > 140)//If it is more than your character restriction
{
val = val.Remove(val.Length - 1);// Remove Last character
editor.Text = val; //Set the Old value
}
@rlingineni
rlingineni / Color Conversions
Created February 13, 2017 01:42
Different Conversions of Color Representations
using System;
using System.Collections.Generic;
namespace rgbConverter
{
class MainClass
{
public static void Main(string[] args)
{
Console.WriteLine("Hello World!");
@rlingineni
rlingineni / Parent.java
Created February 25, 2017 04:03
Reading a Stream in Java
StringBuilder sb = new StringBuilder();
Runtime rt = Runtime.getRuntime();
//You need to use this!
String current = System.getProperty("java.class.path");
System.out.println("Current dir:"+current);
//Make sure to use -classpath flag
Process proc = rt.exec("java -classpath " + current + " Memory");
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Sample.HelloWorldPage"
BackgroundColor= "Black">
<ContentPage.Content>
<ScrollView>
<Grid RowSpacing="5">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
@rlingineni
rlingineni / scheduler.java
Created April 16, 2017 01:31
Scheduling Algorithm driver
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Scheduler {
public static void main(String args[]) throws FileNotFoundException
{
@rlingineni
rlingineni / Job.Java
Created April 26, 2017 22:36
Java implementation of a ShortestRemainingScheduler that takes in a list of Jobs
public class Job {
public Job(String n, int e, int d)
{
name = n;
entryTime = e;
duration = d;
serviceTime = duration;
}
@rlingineni
rlingineni / rock_collect.py
Created August 16, 2017 18:22
Dr.Chrono Rock_Collection Python
# Complete the function below.
def get_rock_index(quantity):
jamie = quantity
print jamie
ned = list(quantity)
ned.sort()
print ned
geoffrey = []