Skip to content

Instantly share code, notes, and snippets.

View thisiscetin's full-sized avatar

Mehmet Cetin thisiscetin

View GitHub Profile
@thisiscetin
thisiscetin / upcoach_request_validator.rb
Last active September 15, 2023 21:34
Upcoach MD5 Request Validator for Rubyist
# frozen_string_literal: true
module UpcoachService
class RequestValidator < ApplicationService
def initialize(full_url, signing_secret)
@full_url = full_url
@signing_secret = signing_secret
end
def call
'''Trains a simple deep NN on the MNIST dataset.
Gets to 98.40% test accuracy after 20 epochs
(there is *a lot* of margin for parameter tuning).
2 seconds per epoch on a K520 GPU.
Using to benchmark my deep learning box.
'''
from __future__ import print_function
@thisiscetin
thisiscetin / genetic.py
Last active November 21, 2017 21:55
Genetic Neural Network
import numpy as np
from timeit import default_timer as timer
from math import log
def sigmoid(x):
return 1 / (1 + np.exp(-x))
class Person(object):
def __init__(self, input, hidden, output):
self.fitness = 0
@thisiscetin
thisiscetin / nested.go
Last active January 27, 2017 15:15
int slice at infinite dimension
package nested
import (
"errors"
"fmt"
"strconv"
"testing"
"github.com/stretchr/testify/assert"
)
package main
import (
"log"
"net/http"
"sync"
"github.com/garyburd/redigo/redis"
"github.com/gorilla/websocket"
uuid "github.com/satori/go.uuid"
@thisiscetin
thisiscetin / heaps.go
Last active January 18, 2024 08:52
Heap's algorithm with Go Lang for possibile permutations of N objects.
// Suppose we have a permutation containing N different elements.
// Heap found a systematic method for choosing at each step a pair of elements to switch,
// in order to produce every possible permutation of these elements exactly once.
// Let us describe Heap's method in a recursive way. First we set a counter i to 0.
// Now we perform the following steps repeatedly until i is equal to N.
// We use the algorithm to generate the (N − 1)! permutations of the first N − 1 elements,
// adjoining the last element to each of these. This generates all of the permutations that
// end with the last element. Then if N is odd, we switch the first element and the last one,
// while if N is even we can switch the i th element and the last one (there is no difference between
// N even and odd in the first iteration). We add one to the counter i and repeat. In each iteration,
@thisiscetin
thisiscetin / fresh_vps.sh
Last active October 3, 2016 20:10
Prepare VPS for docker / docker-compose | Ubuntu 16.04 minimal server (256mb ram)
#! /bin/bash
# First add a new sudo user to system
# sudo adduser xx sudo
# Second change ssh login to key only
# https://www.digitalocean.com/community/tutorials/how-to-set-up-ssh-keys--2
# And then run this file