Skip to content

Instantly share code, notes, and snippets.

View sadikay's full-sized avatar
🎯
Focusing

Sadik Ay sadikay

🎯
Focusing
View GitHub Profile
@sadikay
sadikay / gitlab.rb
Last active February 10, 2017 14:48
moving groups repos between gitlab accounts
require 'json'
PRIVATE_TOKEN = ""
NEW_PRIVATE_TOKEN = ""
OLD_GITLAB_URL = ""
NEW_GITLAB_URL = "http://gitlab.org/api/v3"
PATH = ""
res = `curl --header "PRIVATE-TOKEN: #{PRIVATE_TOKEN}" #{OLD_GITLAB_URL}/groups/`
groups = JSON.parse res
@sadikay
sadikay / mac_os_scheduled_notifier.rb
Created March 17, 2017 17:36
Schedule reminder with notifications on mac os terminal
# brew install terminal-notifier
# gem install rufus-scheduler
# type `irb`
require 'rufus-scheduler'
ENV['TZ'] = 'UTC'
period = '*/10 * * * *' # every 10 minutes cron
scheduler = Rufus::Scheduler.new
@sadikay
sadikay / google_fonts.css
Created April 26, 2017 22:34
All Google Fonts In One CSS File
@font-face {
font-family: 'ABeeZee';
font-style: normal;
font-weight: 400;
src: local('ABeeZee'), local('ABeeZee-Regular'), url(http://fonts.gstatic.com/s/abeezee/v9/JYPhMn-3Xw-JGuyB-fEdNA.ttf) format('truetype');
}
@font-face {
font-family: 'Abel';
font-style: normal;
font-weight: 400;
@sadikay
sadikay / gitlab-ci.yml
Last active November 30, 2017 15:37
Multi branch deploy gitlab side
image: "ruby:2.3.3"
before_script:
- ruby -v
- which ruby
- gem install bundler --no-ri --no-rdoc
- bundle install --jobs $(nproc) "${FLAGS[@]}"
staging_deploy:
except:
@sadikay
sadikay / nginx.conf
Last active November 30, 2017 15:33
Multi branch deploy nginx side
server {
listen 80;
server_name ~^(?<branch_name>.+)\.(?<branch_prefix>.+)\.(?<app_name>.+)\.staging\.exampledomain\.com$;
root /home/apps/$app_name/$branch_prefix/$branch_name/public;
try_files $uri/index.html $uri @app;
location @app {
proxy_pass http://unix:/home/ubuntu/apps/$app_name/$branch_prefix/$branch_name/shared/tmp/sockets/puma.sock;
@sadikay
sadikay / deploy.rb
Last active October 10, 2018 16:49
server 'staging-ip', user: 'staging-user', roles: %w{app db}
set :branch, ENV['BRANCH']
set :application, 'application-name'
set :repo_url, "[email protected]:your-repo-git-url.git"
set :deploy_to, "/home/ubuntu/apps/#{fetch(:application)}/#{fetch(:branch)}"
set :keep_releases, 1
set :copy_exclude, %w(.git/* tmp/*)
set :linked_dirs, %w{log tmp/pids tmp/cache vendor/bundle tmp/sockets}
@sadikay
sadikay / video-to-gif.bash
Last active February 14, 2019 21:34
.mov to .gif - Convert quick time player videos to gif format on macOs command line.
brew install ffmpeg
brew cask install x-quartz #dependency for gifsicle, only required for mountain-lion and above
open /usr/local/Cellar/x-quartz/2.7.4/XQuartz.pkg # runs the XQuartz installer
brew install gifsicle
ffmpeg -i ~/Desktop/in1080.mov -s 920x540 -pix_fmt rgb24 -r 18 -f gif - | gifsicle --optimize=3 --delay=3 > ~/Desktop/out.gif
@sadikay
sadikay / s3_to_azure.rb
Created February 14, 2019 21:30
A ruby script to move files from AWS S3 to Azure.
# gem install azure-storage --pre
# gem install aws-sdk
require 'aws-sdk'
require "azure"
require 'open-uri'
s3 = Aws::S3::Resource.new(
access_key_id: 'AKIA...',
secret_access_key: '************************************',
@sadikay
sadikay / command.sh
Last active October 16, 2019 15:02
MacOS Catalina ruby & gems install errors
# Old Ruby Versions error
RUBY_CONFIGURE_OPTS=--with-openssl-dir=/usr/local/Cellar/openssl/1.0.2t rbenv install 2.3.3
# therubyracer gem install fails. Solution:
bundle config --local build.therubyracer --with-v8-dir=$(brew --prefix v8-315)
# Mysql2 Error
brew install openssl|
gem install mysql2 -v '0.4.10'
# if still fails run:
@sadikay
sadikay / verifyVkn.js
Last active November 8, 2023 13:24 — forked from defiant/verifyVkn.js
Vergi Kimlik Numarası (VKN) doğrulama.
// Examples:
// Valid: "3973535717", "2037637860", "2823097943", "2012460224"
// Not Valid: "3973535711", "123", "9999999999",
function verifyVkn(vkn) {
if (typeof vkn !== 'string') throw new TypeError('vkn should be a string');
if (vkn.length !== 10) throw new TypeError('invalid length');
const digits = vkn.split('');
const control = digits.pop(); // eslint-disable-line