Skip to content

Instantly share code, notes, and snippets.

View ramazansancar's full-sized avatar
📚
Study

Ramazan Sancar ramazansancar

📚
Study
View GitHub Profile
global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.socket mode 660 level admin
stats timeout 30s
user haproxy
group haproxy
daemon
maxconn 2048
@darencard
darencard / auto_git_file.md
Last active February 9, 2025 12:05
Automatic file git commit/push upon change

Please see the most up-to-date version of this protocol on my blog at https://darencard.net/blog/.

Automatically push an updated file whenever it is changed

Linux

  1. Make sure inotify-tools is installed (https://github.com/rvoicilas/inotify-tools)
  2. Configure git as usual
  3. Clone the git repository of interest from github and, if necessary, add file you want to monitor
  4. Allow username/password to be cached so you aren't asked everytime
@jamesbar2
jamesbar2 / postal-codes.json
Last active July 23, 2026 11:43 — forked from matthewbednarski/postal-codes.json
Global postal codes regex formats
[{
"Note": "The first two digits (ranging from 10–43) correspond to the province, while the last two digits correspond either to the city/delivery zone (range 01–50) or to the district/delivery zone (range 51–99). Afghanistan Postal code lookup",
"Country": "Afghanistan",
"ISO": "AF",
"Format": "NNNN",
"Regex": "^\\d{4}$"
}, {
"Note": "With Finland, first two numbers are 22.",
"Country": "Åland Islands",
"ISO": "AX",
@PoeHaH
PoeHaH / gist:ab9d8ac1b4ddee168d4d96c71797df31
Last active November 21, 2022 11:12
JSON representation of EU countries, 2 letter codes and VAT amounts. Good to check the EU VIES database
var euList =
[
{country:'Austria',code:'AT',vat:20},
{country:'Belgium',code:'BE',vat:21},
{country:'Bulgaria',code:'BG',vat:20},
{country:'Croatia',code:'HR',vat:25},
{country:'Cyprus',code:'CY',vat:19},
{country:'Czech Republic',code:'CZ',vat:21},
{country:'Denmark',code:'DK',vat:25},
{country:'Estonia',code:'EE',vat:20},
//this is in the adapters folder I couldn'tcreate it here
import JSONAPIAdapter from 'ember-data/adapters/json-api';
import Ember from 'ember';
export default JSONAPIAdapter.extend({
findAll: function(){
return Ember.$.getJSON('http://api.donanimhaber.com/api/v1/site/NewsSite?pageIndex=0&pageSize=15');
}
#!/usr/bin/env bash
# Adapted from http://scottwb.com/blog/2012/07/14/merge-git-repositories-and-preseve-commit-history/
#
# This is a script for archiving old private repos into an `attic` repo. To use, fill in the `ACCOUNT`
# variable below, then add this script to your "attic" repo, then just `./archive.sh [reponame]` from
# your cloned attic repo. This will take the contents of "reponame" and copy them into a subdirectory in
# attic named "reponame", preserving history. Note that the original repo is not modified in any way
# (we clone it to /tmp/reponame and don't push anything) and this script doesn't auto-push your attic
# repo, so if it all goes horribly wrong, it's very easy to recover.
@refo
refo / parse-telefon.js
Last active September 27, 2022 10:32
Türkiye telefon numarası parse et.
var input = " + 9 0 asdas (532) 123 - 45 6 7 ";
var telefon = input.replace(/(^\D*9?\D*0|\D+)/ig, '');
console.log(telefon);
// Şunu yazdırır:
// 5321234567
//
// Çıktı 10 karakter ise, numara doğru kabul edilebilir.
@ignacioHermosilla
ignacioHermosilla / get_potencial_clients.py
Created April 1, 2016 20:37
obtain potencial pos client using google places
COMUNA_SEARCH = 'Vitacura'
places = {}
def build_url(info):
lat = info['geometry']['location']['lat']
lng = info['geometry']['location']['lng']
return "http://maps.googleapis.com/maps/api/geocode/json?latlng={},{}&sensor=true&language=es".format(lat,lng)
def get_administrative_area(url, area_level='administrative_area_level_3'):
try:
import json
import urllib2
@ajmcagadas
ajmcagadas / sarg.conf
Created February 21, 2016 09:44
custom Sarg Configuration
# sarg.conf
#
# TAG: access_log file
# Where is the access.log
# sarg -l file
#
access_log /250Vault/squid/logs/access.log
# TAG: graphs yes|no
# Use graphics where possible.
@mucahit00
mucahit00 / getSlug.php
Last active December 25, 2023 22:21
Turkish URL Slug
<?php
function getSlug( $data ){
$turkisLetter = ["Ğ","Ü","Ş","İ","Ö","Ç","ğ","ü","ş","ı","ö","ç"," "];
$englishLetter = ["G","U","S","I","O","C","g","u","s","i","o","c","-"];
return str_replace($turkisLetter, $englishLetter, strip_tags(trim($data)));
}
?>