Skip to content

Instantly share code, notes, and snippets.

View Kambaa's full-sized avatar

KambaAbi Kambaa

  • KambaAbi
  • Istanbul, Turkey
View GitHub Profile
@Kambaa
Kambaa / gogs
Created March 25, 2016 14:10 — forked from infostreams/gogs
Debian startup (init.d) script for gogs.io
#! /bin/sh
### BEGIN INIT INFO
# Provides: gogs
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Git repository manager Gogs
# Description: Starts and stops the self-hosted git repository manager Gogs
### END INIT INFO
@Kambaa
Kambaa / Trickshots 1
Created June 15, 2016 13:38 — forked from mojaray2k/Trickshots 1
Use jQuery to send a HEAD request with AJAX and get the size of a file without downloading it. This snippet places the size of the file in braces next to its name. The script issues a HEAD request, which only returns the headers and not the actual content of the file, which means that these requests are fast and lightweight.
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Display files sizes next to download links</title>
</head>
<body>
<a href="001.html" class="fetchSize">First Trickshot</a>
<a href="034.html" class="fetchSize">This Trickshot</a>
<a href="ball.png" class="fetchSize">Ball.png</a>
@Kambaa
Kambaa / gist:054555bd52ccdfebd56f0a4c0edede96
Created June 18, 2016 22:31 — forked from troelskn/gist:1287893
Luhn's algorithm in php
<?php
function is_valid_luhn($number) {
settype($number, 'string');
$sumTable = array(
array(0,1,2,3,4,5,6,7,8,9),
array(0,2,4,6,8,1,3,5,7,9));
$sum = 0;
$flip = 0;
for ($i = strlen($number) - 1; $i >= 0; $i--) {
$sum += $sumTable[$flip++ & 0x1][$number[$i]];
@Kambaa
Kambaa / sehirler.html
Created June 20, 2016 14:14 — forked from aladagemre/sehirler.html
Türkiye Şehir Listesi HTML Select Option
<select name="Sehir">
<option value="0">------</option>
<option value="1">Adana</option>
<option value="2">Adıyaman</option>
<option value="3">Afyonkarahisar</option>
<option value="4">Ağrı</option>
<option value="5">Amasya</option>
<option value="6">Ankara</option>
<option value="7">Antalya</option>
<option value="8">Artvin</option>
@Kambaa
Kambaa / cep_alan_kodlari.html
Last active June 20, 2016 14:28
Cep telefonu kodları html select option
<select name="cep_alan_kodu">
<option value="501">501</option>
<option value="505">505</option>
<option value="506">506</option>
<option value="507">507</option>
<option value="530">530</option>
<option value="531">531</option>
<option value="532">532</option>
<option value="533">533</option>
<option value="534">534</option>
@Kambaa
Kambaa / il_telefon_alan_kodlari.html
Created June 20, 2016 14:29
Türkiye İli Alan Kodları select option
<select name="alanKodu">
<option value="322">ADANA</option>
<option value="416">ADIYAMAN</option>
<option value="272">AFYON</option>
<option value="472">AĞRI</option>
<option value="382">AKSARAY</option>
<option value="358">AMASYA</option>
<option value="312">ANKARA</option>
<option value="242">ANTALYA</option>
<option value="478">ARDAHAN</option>
@Kambaa
Kambaa / dunya_ulkeleri.html
Created June 20, 2016 14:31
Kısaltmalari ile dünya ülkeleri html select option
<select name="ulkeler">
<option value="AF">AFGANİSTAN</option>
<option value="DE">ALMANYA</option>
<option value="US">AMERİKA BİRLEŞİ</option>
<option value="UM">AMERİKAN MİNOR</option>
<option value="AS">AMERİKAN SAMOA</option>
<option value="AD">ANDORA</option>
<option value="AO">ANGOLA</option>
<option value="AI">ANGUİLLA</option>
<option value="AQ">ANTARTİKA</option>
@Kambaa
Kambaa / il_plaka_kodlari.html
Created June 20, 2016 14:32
Türkiye illeri plaka kodlarıyla html select option
<select name="plakalar">
<option value="1">ADANA</option>
<option value="2">ADIYAMAN</option>
<option value="3">AFYON</option>
<option value="4">AĞRI</option>
<option value="68">AKSARAY</option>
<option value="5">AMASYA</option>
<option value="6">ANKARA</option>
<option value="7">ANTALYA</option>
<option value="75">ARDAHAN</option>
@Kambaa
Kambaa / install-docker-mint.sh
Created July 14, 2017 11:49 — forked from mmcc/install-docker-mint.sh
Install Docker on Linux Mint 17
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
sh -c 'echo deb https://apt.dockerproject.org/repo ubuntu-trusty main > /etc/apt/sources.list.d/docker.list'
# Install docker
sudo apt-get update
sudo apt-get purge lxc-docker
sudo apt-get install linux-image-extra-$(uname -r)
sudo apt-get install docker-engine
sudo service docker start
@Kambaa
Kambaa / appcache.php
Created December 18, 2018 13:36 — forked from jrobinsonc/appcache.php
AppCache generator #php #appcache
<?php
function get_dir($dir)
{
$files = array();
$exclude = array('.', '..', 'appcache.php', '.git', '.gitignore', 'nbproject', 'TODO', 'README.md', 'cache.manifest');
foreach (scandir($dir) as $item)
{
if (in_array($item, $exclude)) continue;