Skip to content

Instantly share code, notes, and snippets.

View rafinskipg's full-sized avatar
🏠
Working from home

Venture rafinskipg

🏠
Working from home
View GitHub Profile
@rafinskipg
rafinskipg / client.ts
Created September 28, 2021 14:05
signing-security with web3
const web3 = new Web3(context.library.provider);
const thingToSave = {
message: 'Hello world',
owner: address,
};
const hashedData = web3.eth.accounts.hashMessage(
JSON.stringify(thingToSave)
);
@rafinskipg
rafinskipg / defaultservice.pro.yml
Created December 27, 2020 08:23
defaultservice.pro.yaml
name: Default Service - PRO
on:
push:
tags:
- v*
jobs:
deploy:
runs-on: ubuntu-latest
@rafinskipg
rafinskipg / server.js
Created October 7, 2020 07:08
webex oauth process
// This is the start of the flow, the CLIENT app redirects to this page
app.get('/api/auth/webex', (req, res) => {
// The webex_client_id is an environment variable extracted from the Create integration https://developer.webex.com/docs/integrations
// The scopes and redirect uri are also defined when creating the integration
// Remind to put there your domain url ex: myapp.com or localhost for development
// You will need to change also all the scopes query parameters of this url (you will get them from the "create integration process")
const authUrl = `https://webexapis.com/v1/authorize?client_id=${process.env.WEBEX_CLIENT_ID}&response_type=code&redirect_uri=${encodeURIComponent(process.env.BASE_URL)}%2Fapi%2Fauth%2Fwebex%2Fcallback&scope=meeting%3Arecordings_read%20spark%3Aall%20spark%3Akms%20meeting%3Aschedules_read%20meeting%3Apreferences_write%20meeting%3Arecordings_write%20meeting%3Apreferences_read%20meeting%3Aschedules_write&state=set_state_here`
// We do a redirect to the webex oauth U
const canvas = document.getElementById('canvas');
const context = canvas.getContext('2d');
let before = Date.now()
let dt = 0
const totalFigures = 50
const figures = []
function update(dt) {
const speed = 100 // We can have a different speed per square if we want
figures.forEach(figure => {
figure.x = figure.x + (dt * speed ) > canvas.width ? 0 : figure.x + (dt * speed)
})
}
function loop() {
const now = Date.now()
dt = (now - before) / 1000
// update(dt)
render()
before = now
window.requestAnimationFrame(loop)
const canvas = document.getElementById('canvas');
const context = canvas.getContext('2d');
const totalFigures = 50
const figures = []
function drawSquare(x, y, size, angleOfRotation) {
// Store the painting state in a stack
context.save()
const canvas = document.getElementById('canvas');
const context = canvas.getContext('2d');
function drawSquare(x, y, size, angleOfRotation) {
// Translate in the context the origin of coordinates
context.translate(x, y);
// Rotate the context
const radians = Utils.degreeToRadian(angleOfRotation)
context.rotate(radians);
import Network from '../network'
// Training data for a xor gate
const trainingData = [{
input : [0,0],
output: [0]
}, {
input : [0,1],
output: [1]
}, {
import sigmoid from './sigmoid'
import Connection from './connection'
import Layer from './layer'
class Network {
constructor(numberOfLayers) {
// Create a network with a number of layers. For layers different than the input layer we add a random Bias to each neuron
this.layers = numberOfLayers.map((length, index) => {
const layer = new Layer(length)
if (index !== 0 ) {