Skip to content

Instantly share code, notes, and snippets.

View tejainece's full-sized avatar

Ravi Teja Gudapati tejainece

View GitHub Profile
@tejainece
tejainece / CountNotifier.dart
Created April 12, 2014 14:41
Polymer.dart: Programmatically add template bindings
class CountNotifier extends ChangeNotifier {
int _count = 0;
int get count => _count;
set count(int count) {
_count = notifyPropertyChange(#count, _count, count);
}
}
package main
import "fmt"
import "encoding/json"
import "time"
type (
Container map[string]Variable
Variable interface {
GetName() string
@tejainece
tejainece / array_builtin_fun_arg.c
Created May 3, 2014 19:36
In C, Arrays are always passed as reference while scalar Variables and Structures are passed as value
#include <stdio.h>
#include <string.h>
void printArray(int a[]) {
int i = 0;
for(i = 0; i < 10; i++) {
printf("%d ", a[i]);
}
printf("\n");
}
@tejainece
tejainece / cgo1.go
Last active June 11, 2025 03:13
Examples of calling C code from Golang
package main
//#include<stdio.h>
//void inC() {
// printf("I am in C code now!\n");
//}
import "C"
import "fmt"
func main() {
@tejainece
tejainece / Makefile
Created May 7, 2014 09:43
Get duration, width and height of a video using ffmpeg
CC = gcc
LD_FLAGS = -lavformat -lavcodec
all: get_width_and_height
get_width_and_height: get_width_and_height.c
$(CC) -o $@ $< $(LD_FLAGS)
clean:
rm get_width_and_height
@tejainece
tejainece / fileio.do
Last active August 29, 2015 14:01
VHDL using file i/o for simulation stimulus
#add required waveforms
add wave -position end sim:/fileio/i_a
add wave -position end sim:/fileio/i_b
add wave -position 0 sim:/fileio/i_c
add wave -position end sim:/fileio/clk
add wave -position end sim:/fileio/endoffile
#vcd waveform
vcd file fileio.vcd
vcd add *
@tejainece
tejainece / comp_logic_vector.vhd
Last active August 29, 2015 14:01
VHDL comparison operators
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity comp is port (
a_i : in std_ulogic_vector(3 downto 0);
c_o : out std_ulogic
);
end entity comp;
@tejainece
tejainece / dynamic_cast.cpp
Last active August 29, 2015 14:01
C++: Static and dynamic cast
#include <iostream>
using namespace std;
class Base {
public:
virtual void print() {
cout << "in base" << endl;
}
@tejainece
tejainece / assignable_class.cpp
Last active August 29, 2015 14:01
C++ copy constructor and assignment operator
class Assignable {
private:
int vPrivate = 0;
public:
int vPublic = 0;
Assignable() {
vPrivate = 0;
vPublic = 0;
cout << "Constructed()" << endl;
@tejainece
tejainece / firefox_kiosk.sh
Last active August 29, 2015 14:02
Firefox and chrome Kiosk scripts
wget https://addons.mozilla.org/firefox/downloads/file/143056/ff_fullscreen-7-fx.xpi
unzip ff_fullscreen-7-fx.xpi -d fullscreen
rm ff_fullscreen-7-fx.xpi
#TODO: get id
#TODO: move extension directory with id as name