Skip to content

Instantly share code, notes, and snippets.

View mtigdemir's full-sized avatar
🏠
Working from home

Muharrem Tigdemir mtigdemir

🏠
Working from home
View GitHub Profile
@mtigdemir
mtigdemir / RegistrationController.php
Created October 7, 2020 17:55 — forked from oranges13/RegistrationController.php
Populate external drop downs for datatable filtering
/**
* Process datatables ajax request.
*
* @return \Illuminate\Http\JsonResponse
*/
public function allData(Request $request)
{
$registrations = Registration::with('product')->with('reg_type')->select('registrations.*');
$datatable = Datatables::of($registrations);
@mtigdemir
mtigdemir / remove-old-snaps.sh
Created November 17, 2019 20:54
Remove Unused Snap Revisions
snap list --all | while read snapname ver rev trk pub notes; do if [[ $notes = *disabled* ]]; then sudo snap remove "$snapname" --revision="$rev"; fi; done
@mtigdemir
mtigdemir / MacKeyboardUbuntu.md
Last active November 10, 2019 20:15 — forked from digiter/FixCommandForMacKeyboard.md
Map Command Key to Control For ubuntu + mac keyboard

For each machine running xmodmap will give you the mapping and keycode, take a look first then write the script. I use ubuntu and mac keyboard. The below maps both left and right control and super.

Create an .Xmodmap file in your Linux home directory, with the following contents, then execute xmodmap .Xmodmap

clear control
clear mod4

keycode 37 = Super_L
keycode 105 = Super_R
apiVersion: v1
kind: ReplicationController
metadata:
name: nginx
spec:
replicas: 1
selector:
app: nginx
template:
metadata:
@mtigdemir
mtigdemir / build.sh
Created November 26, 2018 12:59
Go Build on Docker
# Why did you have to build the binary with such an ugly command line?
# You have to explicitly make the binary static.
# This is really important in the Docker community right now because alpine has a different implementation of libc.
# So your go binary wouldn't have had the lib it needed if it wasn't static.
# You created a static binary so that your application could be self-contained.
go build --tags netgo --ldflags '-extldflags "-lm -lstdc++ -static"'
@mtigdemir
mtigdemir / docker-commands.sh
Last active December 24, 2020 19:56
Docker Useful Commands
## Stop All Containers
docker container stop $(docker container ls -aq)
## Remove all stopped containers.
docker rm $(docker ps -a -q)
## Remove all untagged images
docker rmi $(docker images | grep "^<none>" | awk "{print $3}")
@mtigdemir
mtigdemir / index.js
Created April 27, 2018 10:49
Alexa Example Code
/* eslint-disable func-names */
/* eslint quote-props: ["error", "consistent"]*/
/**
* This sample demonstrates a simple skill built with the Amazon Alexa Skills
* nodejs skill development kit.
* This sample supports multiple lauguages. (en-US, en-GB, de-DE).
* The Intent Schema, Custom Slots and Sample Utterances for this skill, as well
* as testing instructions are located at https://github.com/alexa/skill-sample-nodejs-fact
**/
@mtigdemir
mtigdemir / bitbucket-pipelines.yml
Created April 13, 2018 10:49
Deployer Bitbucket Pipeline With Default Images
image: php:7.1.3
pipelines:
branches:
master:
- step:
caches:
- composer
script:
- apt-get update && apt-get install -y unzip openssh-client rsync
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
@mtigdemir
mtigdemir / hosts.yml
Created April 13, 2018 10:47
Deployer Bitbucket Pipeline
test:
stage: test
hostname: {{REMOTE_HOST}}
user: ubuntu
deploy_path: ~/apps/test/htdocs
production:
stage: production
hostname: {{REMOTE_HOST}}
user: ubuntu
@mtigdemir
mtigdemir / deploy.php
Created April 13, 2018 10:45
Deployer Bitbucket Pipeline
<?php
namespace Deployer;
require 'recipe/rsync.php';
require 'recipe/laravel.php';
inventory('hosts.yml');
set('rsync_src', __DIR__);
set('rsync_dest','{{release_path}}');