Skip to content

Instantly share code, notes, and snippets.


Mert Kara amertkara

View GitHub Profile
amertkara /
Created Sep 17, 2017 — forked from atais/
Script upgrading outdated brew casks
#!/usr/bin/env bash
(set -x; brew update;)
(set -x; brew cleanup;)
(set -x; brew cask cleanup;)
red=`tput setaf 1`
green=`tput setaf 2`
reset=`tput sgr0`
amertkara /
Last active Mar 6, 2016
SpringBoot CommandLineRunner
package com.amertkara.springframework.multiplerunners.subcommands.analyzer;
import org.apache.commons.cli.*;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
public class AnalyzerCommand implements CommandLineRunner {
amertkara /
Last active Dec 20, 2015
Installing Jenkins on OSX Server
sudo /usr/sbin/dseditgroup -o create -r 'Jenkins CI Group' -i 600 _jenkins
sudo dscl . -append /Groups/_jenkins passwd "*"
sudo dscl . -create /Users/_jenkins
sudo dscl . -append /Users/_jenkins RecordName jenkins
sudo dscl . -append /Users/_jenkins RealName "Jenkins CI Server"
sudo dscl . -append /Users/_jenkins uid 600
sudo dscl . -append /Users/_jenkins gid 600
sudo dscl . -append /Users/_jenkins shell /usr/bin/false
sudo dscl . -append /Users/_jenkins home /var/jenkins
sudo dscl . -append /Users/_jenkins passwd "*"
View ivy.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<ivy-module version="2.0" xmlns:xsi=""
<info organisation="com.amertkara" module="module-name-comes-here" revision="0.1"/>
<artifact type="jar" name="jar-name" conf="default" />
amertkara / wp-config extras
Created Feb 16, 2015
Extra stuff to make WP more manageable
View wp-config extras
// Skips the FTP details
if(is_admin()) {
add_filter('filesystem_method', create_function('$a', 'return "direct";' ));
define( 'FS_CHMOD_DIR', 0751 );
amertkara /
Last active Aug 29, 2015
Script with headers required to run like django
import sys
import os
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
from django.conf import settings
amertkara /
Last active Apr 7, 2020
Amazon SNS Notification Verification with Python, M2Crypto. When the SNS pushes a notification, a receiver should verify the origin/integrity of the push notification (AWS) using the signature and certificate provided in the notification data. The function `verify_sns_notification` below takes the request object and verifies the origin/integrity…
# -*- coding: utf-8 -*-
import json
import urllib2
from M2Crypto import X509
from base64 import b64decode
from M2Crypto.Err import M2CryptoError
SNS_MESSAGE_TYPE_SUB_NOTIFICATION = "SubscriptionConfirmation"
View get_week_day
def get_week_day(week_year, week_number, week_day=0):
""" For a given year and week_number, gets the day of that particular week
If week_year is 2014, week_number is 14 and week_day = 0,
it returns datetime.datetime(2014, 4, 6, 0, 0)
week_year (int)
week_number (int)
week_day (int): default is Sunday (0)
amertkara / gist:8177991
Last active Jan 1, 2016
Adding a new category to Joomla (Tested on 3.2) some of the category parameters are dependent on your situation so edit them according to your case (i.e. tag IDs might be different in your database)
View gist:8177991
define( '_JEXEC', 1 );
define('JPATH_BASE', dirname(dirname(__FILE__)));
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
$mainframe =& JFactory::getApplication('site');
You can’t perform that action at this time.