Skip to content

Instantly share code, notes, and snippets.

View baybatu's full-sized avatar
🏠
Working from home

Batuhan Bayrakci baybatu

🏠
Working from home
View GitHub Profile
import re
import csv
import urllib
class Parse:
params = re.compile('(?P<key>[\S]*)=\{(?P<value>[\S]*)\}')
prep = re.compile('(?P<key>[\S]*)=(?P<value>[\S]*)')
@ufuk
ufuk / HowToGetHttpServletRequestAndResponseProgrammatically.java
Created October 6, 2016 11:31
To get the request and response objects in Spring MVC projects you can use this code
ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.currentRequestAttributes();
HttpServletRequest httpServletRequest = servletRequestAttributes.getRequest();
HttpServletResponse httpServletResponse = servletRequestAttributes.getResponse();
@ufuk
ufuk / StartEndTimeWithJodaTime.java
Created October 24, 2016 09:09
Joda-Time library provides us a Virtual Clock utility named "DateTimeUtils". This is a demonstration for mocking start-end times.
import org.joda.time.DateTime;
public class StartEndTimeWithJodaTime {
private DateTime startTime;
private DateTime endTime;
public void process() {
startTime = DateTime.now();
@ufuk
ufuk / grep-excluding.sh
Created February 8, 2017 11:17
Grep Excluding
… | grep -v "sen gelme ulan ayı"
@ufuk
ufuk / find-out-stale-branches.sh
Last active October 31, 2017 08:35
Lists git branches ordered by last change time to find out which ones are stale branches.
#!/bin/bash
# DESCRIPTION
# -----------
#
# Produces CSV output like this:
#
# LAST CHANGE TIME, TIME ELAPSED, AUTHOR, BRANCH
# 2017-01-16 14:56:26 +0000, 3 months ago, john.doe@example.com, origin/bug-fix-1
# 2017-01-23 18:27:53 +0300, 2 months ago, john.doe@example.com, origin/new-feature-1
@ufuk
ufuk / learn-which-process-has-allocated-the-tcp-port.sh
Last active March 23, 2018 11:30
Learn which process has allocated the TCP port (for example "8080")
lsof -i tcp:8080
# Example output:
# COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
# java 86935 ...
@pudquick
pudquick / hi_groob.py
Created July 14, 2017 13:48
Search my gists ;p
#!/usr/bin/python
from Foundation import NSWorkspace, NSURL
import urllib
def show_gists():
NSWorkspace.sharedWorkspace().openURL_(NSURL.URLWithString_('https://gist.github.com/search?q=%40pudquick&ref=searchresults'))
def search_gists(search_string):
NSWorkspace.sharedWorkspace().openURL_(NSURL.URLWithString_('https://gist.github.com/search?q=%%40pudquick+%s&ref=searchresults' % search_string))
@livacengiz
livacengiz / detail.md
Last active July 30, 2018 07:59
Otomat Hackathon Detaylar

alt text

Nedir?

Creative coding (yaratıcı programlama) işlevsel olmasından çok yaratıcılığı ön plana çıkarmak için bilgisayar programları yazma işine verilen isimdir. Ortaya çıkan sonuçlar işitsel, görsel ya da başka herhangi bir formda olabilir.

Otomat, sürekli CRUD uygulamalar yapmaktan sıkılmış geliştiriciler olarak birlikte çok ilginç projeler geliştireceğimiz bir hackathon/creative coding partisi. 19-20 Kasım tarihlerinde (gece dahil) bir araya gelerek çok güzel görsel/işitsel ürünler üretip, çok güzel sohbetler edeceğiz.

Neler yapacağız?

Ne yapmak istiyorsanız! Yapılacak şey ve konu üzerine herhangi bir sınırlandırmamız yok. Ama etkinlik günü söyleyeceğimiz bazı teknik sınırlandırmalarımız olacak :) Bireysel olarak ya da grup olarak katılımak konusunda serbestsiniz. Hatta en güzeli herkesle yardımlaşmanız :)

@dettmering
dettmering / ping.1m.py
Created January 30, 2019 08:12
BitBar plugin for showing host availability
#!/usr/local/bin/python3
import os
hosts = [
'google.com',
'microsoft.com'
]
header = []
@ufuk
ufuk / BaseMockitoTest.java
Last active April 9, 2019 20:30
Performs "verify no more interactions" check automatically for all mock objects (works with Mockito version 2). For detailed description: https://ufukuzun.wordpress.com/2019/04/09/ne-olup-bittiginden-habersiz-testlere-derman-mockscollector/ (Turkish)
import org.apache.commons.lang3.ArrayUtils;
import org.junit.After;
import org.junit.runner.RunWith;
import org.mockito.InOrder;
import org.mockito.runners.MockitoJUnitRunner;
import static org.mockito.Mockito.inOrder;
import static org.mockito.Mockito.verifyNoMoreInteractions;
@RunWith(MockitoJUnitRunner.class)