This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Include a Gemfile.lock in your repo when not creating a gem | |
Use a *.gemspec when creating a rubygem and | |
DO NOT include a Gemfile.lock | |
Place all dependencies in the *.gemspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For forming a github v4 API request via Net::HTTP | |
# load the library, it will auto require the uri library | |
require 'net/http' | |
# githubs api url | |
endpoint_url = 'https://api.github.com/graphql' | |
# json formatted graphql request | |
# taken from docs - api v4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
username='foo' | |
adduser $username | |
adduser $username sudo | |
su - $username |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From windows: | |
open up command prompt by hitting start and searching for cmd | |
type: | |
convert F:/fs:ntf | |
Where F: is the directory of the removable flash drive / media | |
fs:ntfs simply goes from FAT to NTFS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://gist.github.com/dfontana/3e27ec5ea3a6f935b7322b580d3df318 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/http' | |
require 'json' | |
uri = URI('https://api.github.com/user/keys') | |
token = "token #{ENV['MY_SUPER_SECRET_API_TOKEN']}" | |
ssh_key_content = File.read(File.join(Dir.home, '.ssh', 'id_rsa.pub')) | |
ssh_key_title = 'my_title' | |
ssh_content = { 'title' => ssh_key_title, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ExtendMe | |
def extension_method | |
puts "Hello from ExtendMe!" | |
end | |
end | |
class Klass | |
extend ExtendMe | |
def self.extended |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This isnt meant to provide all options, just my simple wrapper for personal purposes | |
def generate_ssh_key | |
type = 'rsa' | |
bits = 4096 | |
comment = '[email protected]' | |
system("ssh-keygen -t #{type} -b #{bits} -C #{comment}") | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is using the v3 of github API, I could not find a guide for ssh keys | |
# within the github api v4 | |
# reading public keys, you need admin:public_key & admin:read_key | |
# https://developer.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/ | |
# Both libraries are part of the ruby standard library | |
require 'net/http' | |
require 'json' | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%= form_for(:session, url: login_path) do |f| %> | |
<%= f.label :name %><br> | |
<%= f.text_field :name %><br> | |
<%= f.submit "Login" %> | |
<% end %> | |
<%# To access the params in your controller its simply: %> | |
<%# params[:session][:name] %> |
OlderNewer