Skip to content

Instantly share code, notes, and snippets.

View canerbasaran's full-sized avatar

canerbasaran

View GitHub Profile
@canerbasaran
canerbasaran / tone.js
Last active August 29, 2015 14:21 — forked from robwormald/tone.js
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
var HOUR = 1000*60*60;
/**
* Battery logger calculates battery discharge rate at the most opportune moment.
*/
function BatteryLogger() {
// Instantaneous values: is it charging, and the current level.
this.isCharging = true;
this.batteryLevel = -1;
@canerbasaran
canerbasaran / grayscale.css
Created June 19, 2020 06:02
grayscale website
<style>
body {
-moz-filter: grayscale(100%);
-webkit-filter: grayscale(100%);
filter: gray;
filter: grayscale(100%);
position: relative;
}
</style>
@canerbasaran
canerbasaran / vigenere-turkce.py
Created August 25, 2013 13:56
Türkçe Vigenere Şifreleme
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Turkce Vigenere Sifreleme
# Copyright 2013 Caner BASARAN
# Licensed under the GNU General Public License, version 2.
# See the file http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
HARFLER = u'ABCÇDEFGĞHIİJKLMNOÖPRSŞTUÜVYZ'
@canerbasaran
canerbasaran / tc-check.py
Last active February 5, 2021 08:36
Validation of Turkish Identification Number in Python TC Kimlik No Geçerlilik Kontrolü
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2012 Caner BASARAN
# Licensed under the GNU General Public License, version 2.
# See the file http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
def turkish_id_no_check(tc_no):
''' turkish_id_no_check(long) -> bool
@canerbasaran
canerbasaran / js-rastgele-tc-no.html
Last active November 19, 2022 09:00
Rastgele TC Kimlik No Üreticisi (javascript)
<!--
Rastgele TC Kimlik No Üreticisi
Random Turkish Identification Number Generator
https: //github.com/CanerBasaran
-->
<html><p id="tc"></p>
<script type="text/javascript">
var tcno = "" + Math.floor(900000001 * Math.random() + 1e8),
list = tcno.split("").map(function(t) {
return parseInt(t, 10)
@canerbasaran
canerbasaran / rasgele-tc-kimlik-no.py
Last active November 19, 2022 09:04
Rastgele TC Kimlik No Üreticisi
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2011 Caner BASARAN
# Licensed under the GNU General Public License, version 2.
# See the file http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
from random import randint