Skip to content

Instantly share code, notes, and snippets.

Batuhan Bayrakci baybatu

View GitHub Profile
@ufuk
ufuk / import-csv-file-from-s3-into-aws-redshift.sql
Created Jan 31, 2019
Import CSV file from S3 into AWS Redshift
View import-csv-file-from-s3-into-aws-redshift.sql
-- Before importing, you need to create table
CREATE TABLE example_table
(
...
);
-- Importing...
COPY example_table
FROM 's3://<BUCKET_NAME>/.../example_table.csv'
CREDENTIALS 'aws_access_key_id=...;aws_secret_access_key=...'
@ufuk
ufuk / bash-echo-time-by-timezone.sh
Created Jan 31, 2019
Echo time by timezone in BASH
View bash-echo-time-by-timezone.sh
echo "$(TZ='Europe/Moscow' date +%Y-%m-%d\ %H\:%M)"
# output => 2019-01-31 16:52
@dettmering
dettmering / ping.1m.py
Created Jan 30, 2019
BitBar plugin for showing host availability
View ping.1m.py
#!/usr/local/bin/python3
import os
hosts = [
'google.com',
'microsoft.com'
]
header = []
@ufuk
ufuk / TurkishNumberUtils.java
Last active Jun 5, 2018
Utils for converting numbers to Turkish words
View TurkishNumberUtils.java
public final class TurkishNumberUtils {
private static final String SPACE = " ";
private static final String EMPTY = "";
private static final String[] PERIOD_NAMES = {EMPTY, "bin", "milyon", "milyar", "trilyon", "katrilyon", "kentilyon"};
private static final String[] UNITS_TEXTS = {EMPTY, "bir", "iki", "üç", "dört", "beş", "altı", "yedi", "sekiz", "dokuz"};
@ufuk
ufuk / learn-which-process-has-allocated-the-tcp-port.sh
Last active Mar 23, 2018
Learn which process has allocated the TCP port (for example "8080")
View learn-which-process-has-allocated-the-tcp-port.sh
lsof -i tcp:8080
# Example output:
# COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
# java 86935 ...
@Bonno
Bonno / README.md
Last active Jun 18, 2020
Opening multiple SSH sessions with iTerm automatically. To be used in an Automator flow.
View README.md

Create a new Automater flow

Add 'Service'. Service receives 'no input' in 'iTerm'. Add 'Run AppleScript'.

@pudquick
pudquick / hi_groob.py
Created Jul 14, 2017
Search my gists ;p
View hi_groob.py
#!/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))
@ufuk
ufuk / AsyncConfiguration.java
Last active Sep 10, 2019
The easy way to disable @ Async annotation for test contexts. This can be used to disable @ Scheduled annotation as well.
View AsyncConfiguration.java
package ...configuration;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.scheduling.annotation.EnableAsync;
@Configuration
@EnableAsync
@Profile("!test")
public class AsyncConfiguration {
View grep-excluding.sh
| grep -v "sen gelme ulan ayı"
@ufuk
ufuk / ApplicationContextHolder.java
Last active Feb 28, 2020 — forked from baybatu/getting-spring-bean-from-unmanaged-area.java
Utility bean for getting Spring beans from static context.
View ApplicationContextHolder.java
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
@Component
public class ApplicationContextHolder implements ApplicationContextAware {
private static ApplicationContext applicationContext;
You can’t perform that action at this time.