Skip to content

Instantly share code, notes, and snippets.

View egulhan's full-sized avatar
Here we go again...

Erman Gülhan egulhan

Here we go again...
View GitHub Profile
@egulhan
egulhan / bash_profile_on_mac.txt
Created April 20, 2021 11:00
.bash_profile on Mac
export PATH="$PATH:/Users/eg/development/flutter/bin"
export ANDROID_HOME="/Users/eg/development/Android/sdk"
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools/bin
### aliases
alias npm_ra="cd android && ./gradlew clean && cd .. && react-native run-android"
alias flush_dns="sudo killall -HUP mDNSResponder;sudo killall mDNSResponderHelper;sudo dscacheutil -flushcache"
alias npm_rbr="cd android && ./gradlew clean && ./gradlew bundleRelease && ./gradlew assembleRelease && cd .."
alias ard_up_em="/Users/eg/development/Android/sdk/tools/emulator -writable-system -netdelay none -netspeed full -avd \"Pixel_3_API_26_Oreo_8_\""
@egulhan
egulhan / start_development_environment_programs.bat
Created May 3, 2020 11:16
Windows script to start all your development environment programs
@echo off
REM cd "D:\xampp"
REM start "xampp-control.exe"
cd "C:\Program Files\HeidiSQL"
start heidisql.exe
cd "C:\Program Files\Sublime Text 3"
start sublime_text.exe
@egulhan
egulhan / flutter_dump.dart
Created May 1, 2020 16:25
Dump function to print objects, variables in Flutter while debugging
/// dumps object (mostly used while debugging)
void dump(dynamic object,{bool printIt: true, String key, dynamic context}) {
if (!printIt) {
return;
}
String str = key != null ? key + ': ' : '';
if (!(object is String)) {
String strObject = '';
@egulhan
egulhan / string_masking_functions.php
Last active April 30, 2020 11:22
Some string masking functions using PHP
<?php
function maskString($str)
{
$result = '';
$parts = explode(' ', $str);
foreach ($parts as $part) {
if (!empty($part)) {
if (strlen($part) == 1) {
@egulhan
egulhan / stats.sh
Last active May 3, 2023 19:24
echos memory, disk and cpu usage
printf "Memory\t\tDisk\t\tCPU\n"
MEMORY=$(free -m | awk 'NR==2{printf "%.2f%%\t\t", $3*100/$2 }')
DISK=$(df -h | awk '$NF=="/"{printf "%s\t\t", $5}')
CPU=$(top -bn1 | grep load | awk '{printf "%.2f%%\t\t\n", $(NF-2)}')
echo "$MEMORY\t$DISK\t$CPU"
@egulhan
egulhan / Delete Slack Message Tool
Created August 2, 2019 13:04 — forked from uurtech/Delete Slack Message Tool
Delete All Slack Messages as a Service
This is just a description of how to use Slack Message Tool,
You can backup and delete all the Slack messages at once with this easy app. Just choose what to do and our amazing magic will do that job for you.
https://www.messagebender.com/
@egulhan
egulhan / supervisor-queue-laravel-worker.conf
Created April 14, 2019 14:56
Supervisor configuration for Redis queue Laravel worker
[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=/usr/bin/php ../artisan queue:work redis --sleep=3 --tries=3
directory=/var/www/projects/project1/web/public/
autostart=true
autorestart=true
user=www-data
numprocs=8
redirect_stderr=true
stdout_logfile=/var/www/projects/project1/web/worker.log
@egulhan
egulhan / force-https-apache-directives.conf
Created April 7, 2019 09:59
use these force HTTPS apache directives (in .htaccess) if you have proxied server (such CloudFlare) or you are using a shared hosting
RewriteEngine On
# If we receive a forwarded http request from a proxy...
RewriteCond %{HTTP:X-Forwarded-Proto} =http [OR]
# ...or just a plain old http request directly from the client
RewriteCond %{HTTP:X-Forwarded-Proto} =""
RewriteCond %{HTTPS} !=on
# Redirect to https version
@egulhan
egulhan / calling-traits-contruct-method.php
Last active April 4, 2019 11:23
How to call trait's construct method in PHP
<?php
namespace App\Models\Campaign;
use Illuminate\Database\Eloquent\Model;
use App\Classes\Traits\SetModelConnectionToSlave;
class CampaignDiscount extends Model
{
use SetModelConnectionToSlave {
@egulhan
egulhan / select2-placeholder-width-fix.css
Created March 18, 2019 11:53
FIX - select2 placeholder width cuts off text
/* FIX: Placeholder width cuts off text */
.select2-container--default .select2-search--inline .select2-search__field {
width: initial !important;
}