Skip to content

Instantly share code, notes, and snippets.

View mehmetboraezer's full-sized avatar

Mehmet Bora Ezer mehmetboraezer

View GitHub Profile
@mehmetboraezer
mehmetboraezer / pre_post_hook_prompt.md
Created April 10, 2020 13:32 — forked from jeandat/pre_post_hook_prompt.md
Pre & Post hook for bash prompt (terminal)

PRE / POST Hook for Bash Prompt

Explained here.

AT_PROMPT=1 
# This will run before any command is executed.
function PreCommand() {
  if [ -z "$AT_PROMPT" ]; then
 return
@mehmetboraezer
mehmetboraezer / lambda-basic-auth.js
Created February 6, 2020 14:24 — forked from lmakarov/lambda-basic-auth.js
Basic HTTP Authentication for CloudFront with Lambda@Edge
'use strict';
exports.handler = (event, context, callback) => {
// Get request and request headers
const request = event.Records[0].cf.request;
const headers = request.headers;
// Configure authentication
const authUser = 'user';
const authPass = 'pass';
Byobu is a suite of enhancements to tmux, as a command line
tool providing live system status, dynamic window management,
and some convenient keybindings:
F1 * Used by X11 *
Shift-F1 Display this help
F2 Create a new window
Shift-F2 Create a horizontal split
Ctrl-F2 Create a vertical split
Ctrl-Shift-F2 Create a new session
@mehmetboraezer
mehmetboraezer / quicktime-hangouts-recording.md
Created October 15, 2019 08:25 — forked from caseywatts/quicktime-hangouts-recording.md
Quicktime Hangouts Recording (using soundflower for audio)

Short link to this page: caseywatts.com/quicktime

Other gists & tricks: http://caseywatts.com/gists-and-tricks

Quicktime + Hangouts Recording

Scenario: You want to talk with someone over google hangouts (like for a user study), and you want to record BOTH:

  • the system output audio (from them)
  • the microphone audio (from you)
@mehmetboraezer
mehmetboraezer / clamav-mac.md
Created January 16, 2019 08:12 — forked from Uchean/clamav-mac.md
Get ClamAV running on Mac OS X (using Homebrew)

Get ClamAV running on Mac OS X (using Homebrew)

The easiest way to get the ClamAV package is using Homebrew

$ brew install clamav

Before trying to start the clamd process, you'll need a copy of the ClamAV databases.

Create a freshclam.conf file and configure as so

@mehmetboraezer
mehmetboraezer / analytics.rb
Created January 9, 2019 14:07 — forked from CoryFoy/analytics.rb
An example of calling the Analytics API using machine creds and the V4 API from Ruby
require 'google/apis/analyticsreporting_v4'
require 'googleauth'
include Google::Apis::AnalyticsreportingV4
include Google::Auth
VIEW_ID = "12345678" #your profile ID from your Analytics Profile
SCOPE = 'https://www.googleapis.com/auth/analytics.readonly'
@client = AnalyticsReportingService.new
@mehmetboraezer
mehmetboraezer / movie.2.gif.md
Created January 6, 2019 20:21
Convert movies to gif in OS X Mac

#OS X Movie to animated GIF

ffmpeg -i movie-name.mp4 -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=0 --delay=3 > movie-name.gif

##Options

  • -r 10 tells ffmpeg to reduce the frame rate from 25 fps to 10
  • -s 600x400 tells ffmpeg the max-width and max-height
@mehmetboraezer
mehmetboraezer / taggable.rb
Created October 19, 2018 12:29 — forked from ayrton/taggable.rb
Testing Active Support concerns with rspec in isolation. See first comment for more information.
module Taggable
extend ActiveSupport::Concern
included do
attr_accessible :tags
after_save :set_tags
after_destroy :unset_tags
end
@mehmetboraezer
mehmetboraezer / letsencrypt-GAE.md
Created November 7, 2017 08:18
Set up HTTPS for Google App Engine using Let's Encrypt

Copied from https://www.jeffgodwyll.com/posts/2016/letsencrypt

Let’s Encrypt is a free, automated, and open certificate authority (CA), run for the public’s benefit. Let’s Encrypt is a service provided by the Internet Security Research Group (ISRG)

About Let's Encrypt

This post won't go into details as to what Let's Encrypt is about. We should probably read the FAQs if we want to learn more.

Until the Google App Engine Team fully automate the process of using Let's Encrypt on Google App Engine or even provide some sort of API to handle certs, we'll probably have to find ways of either automating the process just a little bit or stick to some other easier cert authority.

@mehmetboraezer
mehmetboraezer / read-access.sql
Created October 4, 2017 08:49 — forked from oinopion/read-access.sql
How to create read only user in PostgreSQL
-- Create a group
CREATE ROLE readaccess;
-- Grant access to existing tables
GRANT USAGE ON SCHEMA public TO readaccess;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO readaccess;
-- Grant access to future tables
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO readaccess;