Skip to content

Instantly share code, notes, and snippets.

View huseyin's full-sized avatar

Hüseyin Tekinaslan huseyin

View GitHub Profile
@db0sch
db0sch / regenerate_credentials.md
Last active May 11, 2024 10:34
How to regenerate the master key for Rails 5.2 credentials

If your master.key has been compromised, you might want to regenerate it.

No key regeneration feature at the moment. We have to do it manually.

  1. Copy content of original credentials rails credentials:show somewhere temporarily.
  2. Remove config/master.key and config/credentials.yml.enc
  3. Run EDITOR=vim rails credentials:edit in the terminal: This command will create a new master.key and credentials.yml.enc if they do not exist.
  4. Paste the original credentials you copied (step 1) in the new credentials file (and save + quit vim)
  5. Add and Commit the file config/credentials.yml.enc
# munge PATH
pathmunge() {
case ":${PATH}:" in *:"$1":*) return 0 ;; esac
[ "$2" = after ] && PATH=$PATH:$1 || PATH=$1:$PATH
}
@roktas
roktas / denizli.rb
Last active March 10, 2016 11:44
Test üreteci
#!/usr/bin/env ruby
require 'yaml'
require 'forwardable'
module MultipleChoice
module Choice
CHOICES = (:a..:e).to_a
refine Symbol do
@oxUnd
oxUnd / cal.go
Last active September 24, 2020 10:44
Tiny calculator use golang
//
// Tiny calculator
//
// cal := modules.NewCal()
// fmt.Println(cal.MustCal("1x1+4/2x(1+2)"))
// result, err := cal.Cal("1x1+4/2x(1+2)")
// fmt.Println(cal.GetPostfixExpr("1x1+4/2x(1+2)"))
//
package modules
@LeoIannacone
LeoIannacone / monokai-exteded.xml
Last active June 1, 2024 21:40
Monokai Extended - GtkSourceView Theme
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2014 Leo Iannacone <info@leoiannacone.com>
This file was generated from a textmate theme named Monokai Extended
with tm2gtksw2 tool. (Alexandre da Silva)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
@bradrydzewski
bradrydzewski / generate_docker_cert.sh
Last active May 27, 2024 15:59
Generate trusted CA certificates for running Docker with HTTPS
#!/bin/bash
#
# Generates client and server certificates used to enable HTTPS
# remote authentication to a Docker daemon.
#
# See http://docs.docker.com/articles/https/
#
# To start the Docker Daemon:
#
# sudo docker -d \
@LeCoupa
LeCoupa / bash-cheatsheet.sh
Last active July 16, 2024 17:25
Bash CheatSheet for UNIX Systems --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04
  • Dynamic Dispatch
  • Dynamic Method
  • Ghost Methods
  • Dynamic Proxies
  • Blank Slate
  • Kernel Method
  • Flattening the Scope (aka Nested Lexical Scopes)
  • Context Probe
  • Class Eval (not really a 'spell' more just a demonstration of its usage)
  • Class Macros
@chrismccoy
chrismccoy / gitcheats.txt
Last active July 16, 2024 11:44
git cheats
# alias to edit commit messages without using rebase interactive
# example: git reword commithash message
reword = "!f() {\n GIT_SEQUENCE_EDITOR=\"sed -i 1s/^pick/reword/\" GIT_EDITOR=\"printf \\\"%s\\n\\\" \\\"$2\\\" >\" git rebase -i \"$1^\";\n git push -f;\n}; f"
# count total commits in a repo
git rev-list --all --count
# edit all commit messages
git rebase -i --root