Skip to content

Instantly share code, notes, and snippets.

marshallmick007

  • Santa Fe, NM
Block or report user

Report or block marshallmick007

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@marshallmick007
marshallmick007 / pwned.rb
Created Feb 21, 2018 — forked from schmich/pwned-interactive.rb
Check if a password has been pwned with the Pwned Passwords V2 API
View pwned.rb
require 'io/console'
require 'open-uri'
require 'digest'
puts "The 5-character prefix of the password's SHA-1 hash will be sent."
puts "For details, see https://www.troyhunt.com/ive-just-launched-pwned-passwords-version-2/"
print 'Password (hidden): '
password = $stdin.noecho(&:gets).strip
puts
View postgres_new_db.shs
su - postgres
createdb {databasename}
psql {databasename}
databasename=# CREATE USER tester WITH PASSWORD 'test_password';
databasename=# GRANT ALL PRIVILEGES ON DATABASE "databasename" to tester;
databasename=# \q
@marshallmick007
marshallmick007 / index.html
Created Oct 11, 2017
Duck Duck Go Firefox Search
View index.html
<!DOCTYPE>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>start.duckduckgo.com</title>
<link rel="search"
type="application/opensearchdescription+xml"
title="Start DDG"
href="start.duckduckgo.com.xml">
View sequel_migrations.md

Quick Links

Traditional Column Change

Sequel.migration do
  change do
    alter_table(:table_name) do
      add_column :name, String, :null => true
    do
View ruby-large-files.rb
#!/usr/bin/env ruby
# encoding: utf-8
begin
require 'rainbow'
rescue LoadError
puts "Rainbow is not installed"
puts " gem install rainbow"
exit
end
View lets-encrypt.conf
# Allow Generic Lets-Encrypt store
location ^~ /.well-known/acme-challenge/ {
root /srv/apps/www/acme-challenge/;
try_files $uri =404;
}
View building_gems.md

Quickstart

bundle gem yourgemname
cd yourgemname
bundle install
gem build ./yourgemname.gemspec

Referencing local gems

View linux_tips.md

Install Packages a batch at a time on Arch Linux

sudo pacman -S `pacoutdated |  cut -d ' ' -f 1 | head -n 10 | tr '\n' ' '`

Install all libs

 sudo pacman -S `pacoutdated | grep "^lib" | cut -d ' ' -f 1 | tr '\n' ' '`
View ruby_sequel_cheatsheet.md

LIKE

model.where(Sequel.like(:column, "%#{term}%"))

UPDATE

model.where(:column => value).update(:enabled => false)
View ruby_reminders.md

Merging two hashes

defaults = { :test => 1, :original => 'thing' }
overrides = { test: '42', :some_new_thing => 'cats' }
defaults.merge(overrides)
#{
#              :test => "42",
#          :original => "thing",
#    :some_new_thing => "cats"
You can’t perform that action at this time.