Skip to content

Instantly share code, notes, and snippets.

Mert Kara amertkara

Block or report user

Report or block amertkara

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@amertkara
amertkara / cask_upgrade.sh
Created Sep 17, 2017 — forked from atais/cask_upgrade.sh
Script upgrading outdated brew casks
View cask_upgrade.sh
#!/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
amertkara / AnalyzerCommand.java
Last active Mar 6, 2016
SpringBoot CommandLineRunner
View AnalyzerCommand.java
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;
@Component
public class AnalyzerCommand implements CommandLineRunner {
@amertkara
amertkara / create_user.sh
Last active Dec 20, 2015
Installing Jenkins on OSX Server
View create_user.sh
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="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
<info organisation="com.amertkara" module="module-name-comes-here" revision="0.1"/>
<publications>
<artifact type="jar" name="jar-name" conf="default" />
</publications>
@amertkara
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
amertkara / django_manage_script.py
Last active Aug 29, 2015
Script with headers required to run like django manage.py
View django_manage_script.py
import sys
import os
sys.path.append('path/to/django/project/root')
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
from django.conf import settings
@amertkara
amertkara / aws_utils.py
Last active Jul 31, 2019
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…
View aws_utils.py
# -*- 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"
SNS_MESSAGE_TYPE_NOTIFICATION = "Notification"
SNS_MESSAGE_TYPE_UNSUB_NOTIFICATION = "UnsubscribeConfirmation"
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)
Args:
week_year (int)
week_number (int)
week_day (int): default is Sunday (0)
@amertkara
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
<?php
define( '_JEXEC', 1 );
define('JPATH_BASE', dirname(dirname(__FILE__)));
define( 'DS', DIRECTORY_SEPARATOR );
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
$mainframe =& JFactory::getApplication('site');
$mainframe->initialise();
jimport('joomla.application.component.model');
You can’t perform that action at this time.