Skip to content

Instantly share code, notes, and snippets.

View rukshn's full-sized avatar
🖥️
Working

Rukshan Ranatunge rukshn

🖥️
Working
View GitHub Profile
@rukshn
rukshn / twitpic.php
Created August 18, 2012 04:37
Using this code one can easily upload pictures to TwitPic using TwitPic API and Abraham Willium's Twitter OAuth Library and OAuth Echo
<?php
//using this code one can easily upload pictures to TwitPic using TwitPic API and Abraham Willium's Twitter OAuth class
/**
* @file
* User has successfully authenticated with Twitter. Access tokens saved to session and DB.
*/
/* Load required lib files. */
session_start();
require_once('twitteroauth/twitteroauth.php');
@rukshn
rukshn / sreader.php
Created August 19, 2012 04:33
A simple Facebook social reader app. This can be improved a lot
<?php
$app_id = "xxxxxxx"; //facebook app id
$redirect_url = "xxxxxx"; //url to redirct after getting the token, should be in the same domain of the canvas url
$app_secret = "xxxxxxx"; //facebook app secret
session_start();
$code = $_REQUEST['code'];
@rukshn
rukshn / gist:7061578
Created October 19, 2013 21:08
Unfortunate Facebooking. Post
We talk about Facebook, online privacy and bullying online, but we don't realize the gravity of it until it happens to someone we know. This is an incident that's currently happening to a friend of mine and I'm blogging about it to let people know and get attention of someone that can help.
This friend of mine who I won't tell the name is a student of a government university, and recently she had a request for a date by a person from the navy which she has refused, and because of this this person has created a fake Facebook profile of her using her photos but with a different name and has started posting bad things that are ruining her real life.
Also making things worse the person who created this fake profile is adding her real life friends to the fake Facebook profile, because the fake Facebook profile is using her real photos people that she know are accepting the requests and thins are getting worse and worse. And making things extra worse the people who's behind all this is telling that he would stop
@rukshn
rukshn / Space Aids
Last active August 29, 2015 14:05
No one likes an Ad filled website, but what happens when that is one the most visited news websites, it sucks. This is a small browser bookmarklet that helps you to get rid of most of the ads at Daily Mirror, FT.lk, Lankadeepa and Mirror Sports. Bookmark this bookmarklet (I think you know how) and when you are reading news at any of those websit…
javascript:(function(){
if (!($ = window.jQuery)) {
var jq = document.createElement('script');
jq.src = "//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js";
document.body.appendChild(script);
}
else {
releasetheKraken();
}
@rukshn
rukshn / gist:edd64d4f6a5d1d7edd5c
Created October 24, 2014 17:44
Enable right click at topjobs.lk
var message="Function Disabled!";function clickIE4(){if(event.button==2){alert(message);return ture}}function clickNS4(a){if(document.layers||document.getElementById&&!document.all){if(a.which==2||a.which==3){alert(message);return true}}}if(document.layers){document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS4}else{if(document.all&&!document.getElementById){document.onmousedown=clickIE4}}document.oncontextmenu=new Function("alert(message);return ture");
@rukshn
rukshn / perceptron.js
Last active July 22, 2016 16:19
Simple perceptron just as I wrote it in node JS.
// Sigmoid function
function S(num){
var y = 1 / (1 + Math.exp(num)); // y = 1/(1+e^x)
return(y)
}
// Training function
function process(arr) {
var w = []
var bias = 0.5
@rukshn
rukshn / xor.py
Created July 25, 2016 16:31
XOR perseptron
import numpy as np
def S(x):
return 1/(1+np.exp(-x))
win = np.random.randn(2,2)
wout = np.random.randn(2,1)
eta = 0.25
# dummy values used to see if everything is correct manually
import numpy as np
low = 0
high = 9
chromes = 200
epoch = 2000
achivement = 0.58
cr = 0.4
mr = 0.3
Privacy Policy
Refresh Labs built the Poke app as a Free app. This SERVICE is provided by Refresh Labs at no cost and is intended for use as is.
This page is used to inform visitors regarding our policies with the collection, use, and disclosure of Personal Information if anyone decided to use our Service.
If you choose to use our Service, then you agree to the collection and use of information in relation to this policy. The Personal Information that we collect is used for providing and improving the Service. We will not use or share your information with anyone except as described in this Privacy Policy.
The terms used in this Privacy Policy have the same meanings as in our Terms and Conditions, which is accessible at Poke unless otherwise defined in this Privacy Policy.
Information Collection and Use
@rukshn
rukshn / app.js
Created March 21, 2020 11:31
A way to pin authenticate a twitter app using NodeJs and commandline
// *************
// A way to pin authenticate a twitter account using commandline and NodeJs
// Get your app consumer key and secret from dev.twitter.com
// Fill them below
// npm install to install packages
// node app.js
var oauth = require('oauth');
// Get your credentials here: https://dev.twitter.com/apps