Skip to content

Instantly share code, notes, and snippets.

View ramithuh's full-sized avatar

Ramith Hettiarachchi ramithuh

View GitHub Profile
@ramithuh
ramithuh / designer.html
Created February 15, 2015 11:32
designer
<link rel="import" href="../notification-elements/notification-alert.html">
<link rel="import" href="../topeka-elements/topeka-datasource.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-submenu.html">
<link rel="import" href="../core-item/core-item.html">
<polymer-element name="my-element">
@ramithuh
ramithuh / edison_arduino.ino
Created July 14, 2015 16:09
Upload this sketch to your Intel Edison
int led=8; //int for led pin number
int c = -1; // int for income value
void setup()
{
Serial.begin(115200); //set serial with baud rate
pinMode(led,OUTPUT); //set the pin as an output
@ramithuh
ramithuh / proc_edison
Created July 14, 2015 16:13
execute this sketch
import com.leapmotion.leap.*; //leap motion library
import processing.serial.*; //serial communication library
Controller leap; //define a controller
Serial port; //define a port
void setup(){
size(250,250); //sketch size
leap = new Controller(); // initialize the controller
port = new Serial(this, Serial.list()[2], 115200);//initialize the port in my case its [2]
@ramithuh
ramithuh / coffee vs.js
Last active September 22, 2016 08:01
Examples with coffeescript
### The implementation of binary search that is tested.
# Return the index of an element in a sorted list. (or -1, if not present)###
index = (list, target) ->
[low, high] = [0, list.length]
while low < high
mid = (low + high) >> 1
val = list[mid]
return mid if val is target
if val < target then low = mid + 1 else high = mid
@ramithuh
ramithuh / 347.py
Created October 22, 2016 10:32
project euler 347
import math
arr=[]
#this is for prime
def isprime(k):
if(k==1 or k==0):
return 0
for i in range(2,int(k**(0.5))+1):
if(k%i==0):
@ramithuh
ramithuh / code3.m
Created November 10, 2018 18:05
Notch Filter
close all;
clear all;
load('noisy_ECG_sig.mat')
y=noisy_ECG_sig; %the signal loaded
L=length(y)
sampling_freq = 1000
figure; % plot the original signal
num=[0.9955 -1.8936 0.9955];
den=[1 -1.8936 0.9911];
zplane(num,den)
grid on;
%freqz(num,den,100);
on run {input, parameters}
do shell script "open /Users/ramith/Documents/SEM4_TRONIC_ACA"
return input
end run
@ramithuh
ramithuh / clipboard-compress.sh
Created May 3, 2020 16:04
Compress the screenshots saves in a folder and copy them to clipboard (macOS preview screenshots)
for f in "$@"
do
/usr/local/bin/pngquant 32 --skip-if-larger --strip --ext=.png --force "$f"
/usr/local/bin/zopflipng -y "$f" "$f"
/Users/ramith/Documents/ss/impbcopy "$f"
done
@ramithuh
ramithuh / wandb_resume.py
Created February 10, 2022 21:00
resume wandb project and log data
import wandb
wandb.init(id="31cnstm6", project="test", resume="must")
wandb.log({"this was added later": 1241241})