Skip to content

Instantly share code, notes, and snippets.

View ridvanaltun's full-sized avatar
🐴
prostagma?

Rıdvan Altun ridvanaltun

🐴
prostagma?
View GitHub Profile
@ridvanaltun
ridvanaltun / GitCommitEmoji.md
Created July 25, 2019 07:17 — forked from parmentf/GitCommitEmoji.md
Git Commit message Emoji
@ridvanaltun
ridvanaltun / macOS-X-El-Capitan-with-Vagrant.md
Last active June 25, 2021 09:46
macOS X El Capitan with Vagrant

Overview

Version: OS X El Capitan 10.11.6

Build Version: 15G31

Provider: VirtualBox

System Requirements

@ridvanaltun
ridvanaltun / create-vagrant-box.md
Created June 29, 2021 19:16
Create Vagrant box from existing Vagrant Box
# create an example ubuntu box
vagrant init bento/ubuntu-18.04

# deploy it
vagrant up

# connect to the box over ssh
vagrant ssh
@ridvanaltun
ridvanaltun / execute-shell-commands-in-node.md
Created July 7, 2021 22:43
Execute shell commands in Node
import { exec } from 'child_process';

/**
 * Execute simple shell command (async wrapper).
 * @param {String} cmd
 * @return {Object} { stdout: String, stderr: String }
 */
async function sh(cmd) {
 return new Promise(function (resolve, reject) {
@ridvanaltun
ridvanaltun / async-await-error-handling.md
Last active July 8, 2021 10:39
A clever way to handling errors in async-await

logic

async function fetchData() {
  try{
    const data = await fetch()
    return [data, null]
  } catch(error) {
    return [null, error]
 }
@ridvanaltun
ridvanaltun / user_aliases.cmd
Last active July 8, 2021 11:59
User Aliases for Cmderr
;= @echo off
;= rem Call DOSKEY and use this file as the macrofile
;= %SystemRoot%\system32\doskey /listsize=1000 /macrofile=%0%
;= rem In batch mode, jump to the end of the file
;= goto:eof
;= Common directories
desktop=cd /d "%HOME%"\Desktop"
home=cd /d "%HOME%"
@ridvanaltun
ridvanaltun / remove-file-git-history.md
Last active August 5, 2021 22:59
Remove chunks from git history

Why?

  • Removing Crazy Big Files
  • Removing Passwords, Credentials & other Private data

Detect Large Files on Git History

Note: numfmt is not available on macOS, install with brew install coreutils command before proceed.

Regex List

// Phone Number
function mobilePhoneRegEx(val) {
    return /^(05)([0-9]{2})\s?([0-9]{3})\s?([0-9]{2})\s?([0-9]{2})$/.test(val);
    /*
    05231231212
    0523 123 12 12
    */
@ridvanaltun
ridvanaltun / bitbucket-pipelines.yml
Created August 13, 2021 20:55
Dispatch GitHub Action From Bitbucket
# Template NodeJS build
# This template allows you to validate your NodeJS code.
# The workflow allows running tests and code linting on the default branch.
image: node:10.15.3
pipelines:
branches:
main:
@ridvanaltun
ridvanaltun / store-files-in-secrets.md
Last active August 14, 2021 06:23
Store Files in Secrets