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 / dag.py
Last active January 16, 2023 08:30
airflow_default_dag
import datetime
import pendulum
import os
import requests
from airflow.decorators import dag, task
from airflow.providers.postgres.hooks.postgres import PostgresHook
from airflow.providers.postgres.operators.postgres import PostgresOperator
@rukshn
rukshn / hangman.py
Last active February 23, 2022 10:14
A simple hangman game written in Python
import random
words = ['apple', 'crane', 'kane', 'lime', 'kite']
word = random.choice(words)
game = ['_']*len(word)
wrog_letters = []
lives = 6
print (game)
while lives > 0:
val = input("Guess the letter ? ")
@rukshn
rukshn / district-picker.blade.php
Last active November 10, 2021 18:18
Simple Blade Components
@props(['value', 'name'])
@php
$districts = ['Ampara', 'Anuradhapura', 'Badulla', 'Batticaloa', 'Colombo',
'Galle', 'Gampaha', 'Hambanthota', 'Jaffna', 'Kaluthara', 'Kandy',
'Kegalle', 'Killinochchi', 'Kurunagala', 'Mannar', 'Matale', 'Mathara',
'Monaragala', 'Mullathivu', 'Nuwara Eliya', 'Polonnaruwa', 'Puttalam',
'Rathnapura', 'Trincomalee', 'Vavuniya']
@endphp
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
@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
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
import numpy as np
low = 0
high = 9
chromes = 200
epoch = 2000
achivement = 0.58
cr = 0.4
mr = 0.3
@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
@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 / 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");