Skip to content

Instantly share code, notes, and snippets.

View gencer's full-sized avatar
:octocat:
Working remotely

Gencer W. Genç gencer

:octocat:
Working remotely
View GitHub Profile
@gencer
gencer / Program.cs
Last active August 29, 2015 14:12 — forked from SneakyBrian/Program.cs
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Xml;
using Newtonsoft.Json;
using Formatting = Newtonsoft.Json.Formatting;
namespace XML2JSON
{
class Program
@gencer
gencer / Program.cs
Last active August 29, 2015 14:12 — forked from SneakyBrian/Program.cs
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Xml;
using Newtonsoft.Json;
using Formatting = Newtonsoft.Json.Formatting;
namespace XML2JSON
{
class Program

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

@gencer
gencer / InteractiveLoginListener.php
Created September 28, 2015 13:32 — forked from snc/InteractiveLoginListener.php
Custom FOSUB redirects
<?php
namespace My\Bundle\EventListener;
use My\Bundle\User\User;
use Symfony\Component\Routing\Router;
use Symfony\Component\Security\Http\Event\InteractiveLoginEvent;
class InteractiveLoginListener
{
@gencer
gencer / MimeType.php
Last active December 8, 2015 08:21 — forked from Erutan409/MimeType.php
Mime Type Function for PHP
<?php
function mime_type($file) {
// there's a bug that doesn't properly detect
// the mime type of css files
// https://bugs.php.net/bug.php?id=53035
// so the following is used, instead
// src: http://www.freeformatter.com/mime-types-list.html#mime-types-list
@gencer
gencer / parsel.sql
Created May 18, 2016 11:51
Parsel: A Simple Function for Parallel Query in Postgres using Dblink
-- DROP FUNCTION IF EXISTS public.parsel(db text, table_to_chunk text, pkey text, query text, output_table text, table_to_chunk_alias text, num_chunks integer);
CREATE OR REPLACE FUNCTION public.parsel(db text, table_to_chunk text, pkey text, query text, output_table text, table_to_chunk_alias text default '', num_chunks integer default 2)
RETURNS text AS
$BODY$
DECLARE
sql TEXT;
min_id integer;
max_id integer;
step_size integer;
lbnd integer;
@gencer
gencer / pgprepmgr.sh
Created July 15, 2016 03:37 — forked from dansimau/pgprepmgr.sh
Wrapper for pgpools' pcp tools to help you manage your pgpool setup and postgresql cluster. See usage in the comment below.
#!/bin/bash
#
# pgpool-II replication manager
#
# Interfaces with pgpool's pcp command-line tools to provide access to common functions for managing
# load-balancing and failover.
#
# dsimmons@squiz.co.uk
# 2011-08-28
@gencer
gencer / qwebchannel-client.html
Created September 3, 2016 08:41 — forked from m-seker/qwebchannel-client.html
QWebChannel Javascript Connector
<!DOCTYPE html>
<html>
<head>
<title>QWebChannel Client</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.css" />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script type="text/javascript" src="qwebchannel.js"></script>
@gencer
gencer / colors.py
Created April 24, 2017 18:24 — forked from jossef/colors.py
python coloring for linux, based on this answer http://stackoverflow.com/a/26445590/3191896
def color(text, **user_styles):
styles = {
# styles
'reset': '\033[0m',
'bold': '\033[01m',
'disabled': '\033[02m',
'underline': '\033[04m',
'reverse': '\033[07m',
@gencer
gencer / colors.py
Created April 24, 2017 18:25 — forked from arulrajnet/colors.py
python coloring for linux, based on this answer http://stackoverflow.com/a/26445590/3191896 and modified to make it more usable in a pythonic way.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
class Color(object):
"""
reference from https://gist.github.com/Jossef/0ee20314577925b4027f and modified bit.
"""
def __init__(self, text, **user_styles):