Skip to content

Instantly share code, notes, and snippets.

Avatar

Ekin Ertaç ekinertac

View GitHub Profile
View colorShader.js
// Usage:
//
// colorShader(10, '#f50'); // brighten color 10%
// colorShader(-10, '#f50'); // darken color 10%
//
// colorShader(10, '#f50', '#0ad74e'); // blend two colors
// colorShader(10, 'rgb(210, 200, 20)', 'rgb(20,156,210)'); // blend two colors
const colorShader = (ratio=10, color1, color2 = false) => {
let p = ratio / 100;
View ap.sh
ps -ylC apache2 | awk '{x += $8;y += 1} END {print "Apache Memory Usage (MB): "x/1024; print "Average Proccess Size (MB): "x/((y-1)*1024)}'
@ekinertac
ekinertac / admin.py
Created Apr 23, 2019
CssClassMixin for Django-Admin form elements
View admin.py
class PostAdmin(CssClassMixin, admin.ModelAdmin):
form_css_clasess = {
'title': 'col-sm-8',
'slug': 'col-sm-12'
}
@ekinertac
ekinertac / pyenv+virtualenv.md
Created Jun 1, 2018 — forked from eliangcs/pyenv+virtualenv.md
Cheatsheet: pyenv, virtualenvwrapper, and pip
View pyenv+virtualenv.md

Cheatsheet: pyenv, virtualenvwrapper, and pip

Installation (for Mac OS)

Install pyenv with brew

brew update
brew install pyenv
@ekinertac
ekinertac / s3storages.settings.py
Last active Apr 11, 2018
Django's Amazon S3 Configuration
View s3storages.settings.py
#
# Install django-storages app with pip
# $ pip install django-storages
#
INSTALLED_APPS = (
...
'storages',
...
)
@ekinertac
ekinertac / sqlite3_to_mysql.md
Last active Apr 11, 2018
Converts sqlite3 database dumps to mysql dump format
View sqlite3_to_mysql.md
sqlite3 databse.db .dump > sqlite3_database_dump.sql
python sqlite3_to_mysql.py database.sql > mysql_database_dump.sql
View newtab.html
<html>
<head>
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
<link href="https://fonts.googleapis.com/css?family=Raleway:100,200,300" rel="stylesheet">
<style>
body {
background-image: url("http://static.simpledesktops.com/uploads/desktops/2014/10/15/tetons-at-night.png");
background-size: cover;
color: rgba(255,255,255,.5);
@ekinertac
ekinertac / commands.sh
Last active Oct 31, 2016
MySQL pid file permisson error solution
View commands.sh
############################
# TRY LINE 33 and 34 BEFORE RUN THIS !!!!
############################
mysqldump --all-databases > /tmp/all.mysql.dump.sql
ps -ax | grep mysql
# stop and kill any MySQL processes
brew remove mysql
@ekinertac
ekinertac / Preferences.sublime-settings
Created Jul 13, 2016
Sublime Text default settings for OSX
View Preferences.sublime-settings
{
"color_scheme": "Packages/Theme - Brogrammer/brogrammer.tmTheme",
"font_face": "Inconsolata",
"font_size": 13,
"margin": 8,
"rulers": [120],
"translate_tabs_to_spaces": true,
"highlight_line": true,
"caret_style": "blink",
View init.coffee
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
You can’t perform that action at this time.