Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
#!/usr/bin/env ruby | |
require "colorize" | |
installed_version = `kitty --version`.match(%r:(\d+\.\d+\.\d+):)[1] | |
# => "0.28.1" | |
constants_py = `curl --silent https://raw.githubusercontent.com/kovidgoyal/kitty/master/kitty/constants.py` | |
current_version = constants_py.match(%r:Version\((\d+, \d+, \d+)\)$:)[1].split(',').map(&:to_i).join('.') | |
# => "0.28.1" |
#!/usr/bin/env ruby | |
require "colorize" | |
def wow_name(string) | |
fits = string.size <= 12 | |
if fits | |
"=> \"#{string.downcase.capitalize}\" fits and would make a great name! ✅".green | |
else | |
# cutoff = string[0...12] |
#!/usr/bin/env ruby | |
# frozen_string_literal: true | |
require 'bundler/inline' | |
gemfile do | |
source 'https://rubygems.org' | |
gem 'colorize' | |
end |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
# remap git to point to g() | |
git () { | |
g "$@" | |
} | |
# git super command | |
# make sure with zsh that the git plugin is not used | |
# as it will override this command | |
g () { | |
if [[ $# -gt 0 ]] |
#!/usr/bin/env ruby | |
require 'etc' | |
commands = {} | |
File.readlines(File.join(Etc.getpwuid.dir, '.zsh_history')).each do |l| | |
l = l.encode('utf-8', 'binary', :undef => :replace) | |
next if l == '' | |
next unless l.match(/: \d+:/) | |
l = l.sub(';','[SPLIT]').split('[SPLIT]') | |
key = l.last.split.first |
require 'nokogiri' | |
require 'net/http' | |
require 'uri' | |
require 'byebug' | |
require 'open-uri' | |
class LinuxKernel | |
OFFICIAL_KERNEL_URL = 'https://www.kernel.org/'.freeze | |
UBUNTU_KERNEL_BASE_URL = 'http://kernel.ubuntu.com/~kernel-ppa/mainline/'.freeze |
# config/initializers/01_session_security.rb | |
module SessionSecurity | |
def generate_sid | |
sid = SecureRandom.hex(32) | |
sid.encode!(Encoding::UTF_8) | |
sid | |
end | |
end |
class RuboCopper | |
def analyze | |
system 'rubocop', '--display-cop-names', *files | |
end | |
def autofix | |
system 'rubocop', '--auto-correct', '--display-cop-names', *files | |
end | |
def valid? |