Skip to content

Instantly share code, notes, and snippets.

@alicanerdogan
alicanerdogan / setup.rb
Created April 21, 2021 11:54
Setup Mac Script
#!/usr/bin/env ruby
require 'open3'
aliases =
%{git_current_branch() {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
}
gpush() {
git push origin $(git_current_branch)
@alicanerdogan
alicanerdogan / install-chrome.sh
Created October 24, 2017 08:54
Headless Chrome on Ubuntu 16
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
apt-get update
apt-get install -y google-chrome-stable
// google-chrome --headless --no-sandbox --disable-gpu
@alicanerdogan
alicanerdogan / javascript.json
Last active February 22, 2022 06:49
React/Redux Snippets for VSCode
{
"Set component state": {
"prefix": "%setstate",
"description": "Call set state function",
"body": [
"this.setState(state => Object.assign({}, state, {$1}));"
]
},
"Modify state": {
"prefix": "%modifystate",
@alicanerdogan
alicanerdogan / phoenix.sh
Created April 15, 2017 14:03
Phoenix Framework Cheatsheet
# Create a model with following columns
# possible field types: string, integer, references, float, boolean
# to create a belongs to association: ($OWNER)_id:references:$OWNER_PLURAL
mix phoenix.gen.model $MODEL_NAME $PLURAL_MODAL_NAME $FIELD_NAME:FIELD_TYPE
# mix phoenix.gen.model Note notes content:string user_id:references:users
@alicanerdogan
alicanerdogan / docker.sh
Last active August 22, 2017 20:19
Docker Cheat Sheet
# list all containers dead or alive
docker ps -a
# stop and remove all containers
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
# create a container
export ENTRY_POINT=bash
docker run -d -it --name $CONTAINER_NAME -v $HOST_MOUNT_POINT:$GUEST_MOUNT_POINT -p $HOST_PORT:$GUEST_PORT $IMAGE $ENTRY_POINT
@alicanerdogan
alicanerdogan / .eslintrc
Created March 15, 2017 15:24
ESLint Configuration
{
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"env": {
"browser": true,
@alicanerdogan
alicanerdogan / html5_template.json
Created December 22, 2016 07:12
VSCode HTML5 Template
"HTML Template": {
"prefix": "thtml",
"body": [
"<!DOCTYPE HTML>",
"<html>",
"<head>",
" <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />",
" <title>$1</title>",
"</head>",
"<body>",
@alicanerdogan
alicanerdogan / Dockerfile
Last active April 3, 2017 14:45
Dockerfile for Phoenix on Ubuntu 16.04
FROM ubuntu:16.04
MAINTAINER Alican Erdogan <[email protected]>
RUN apt-get update && \
apt-get install -y language-pack-en-base && \
locale-gen "en_US.UTF-8"
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8'
RUN apt-get install -y sudo wget git nano nginx postgresql postgresql-contrib
@alicanerdogan
alicanerdogan / .bashrc
Created September 6, 2016 19:54
Default bashrc with git branch
# Preview:
# ae > /mnt/c/Users/Alican/Repos/aTorrent (master)
# $
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
export PS1="\[$(tput bold)\]\[\033[38;5;230m\]\u\[$(tput sgr0)\]\[$(tput sgr0)\]\[\033[38;5;15m\] \[$(tput bold)\]>\[$(tput sgr0)\] \[$(tput sgr0)\]\[\033[38;5;14m\]\w\[$(tput sgr0)\]\[\033[38;5;15m\] \[\033[38;5;11m\]\$(parse_git_branch)\n\[$(tput bold)\]\[$(tput sgr0)\]\[\033[38;5;230m\]\\$\[$(tput sgr0)\]\[$(tput sgr0)\]\[\033[38;5;15m\] \[$(tput sgr0)\]"