the bash_profile
snippet will let you run the first file when you press tab
when you have empty command ,
you need to put the cmd
file in your path
and make it executable with chmod +x cmd
View explain.rb
class Explainer < ActiveSupport::LogSubscriber | |
def sql(event) | |
payload = event.payload | |
return if ignore_payload?(payload) | |
debug color(ActiveRecord::Base.connection.explain(payload[:sql], payload[:binds]), :yellow) | |
end | |
private |
View web-history.sh
#!/usr/bin/env bash | |
cp ~/.config/google-chrome/Default/History /tmp/History | |
sqlite3 /tmp/History "select url, title from urls;" \ | |
| dmenu -i -l 20 -fn "Source Code Pro:regular:size=16" \ | |
| awk 'BEGIN { FS = "|" } ; { print $1 }' \ | |
| xargs xdg-open |
View import-image-to-directory
#!/usr/bin/env ruby | |
# frozen_string_literal: true | |
require 'bundler/inline' | |
require 'fileutils' | |
gemfile do | |
source 'https://rubygems.org' | |
gem 'gtk3' | |
end |
View index.html
<html> | |
<body> | |
<form id="userform"> | |
<label>Username</label> | |
<input id="username" type="text"> | |
<label>Password</label> | |
<input id="password" type="password"> | |
<label>Other peer Username (only if your the initiator)</label> | |
<input id="to" type="text"> | |
<button onclick="CreateUser()" type="button">Create</button> |
View foreground-process.ps
Add-Type @" | |
using System; | |
using System.Runtime.InteropServices; | |
public class Tricks { | |
[DllImport("user32.dll")] | |
public static extern IntPtr GetForegroundWindow(); | |
} | |
"@ | |
while($TRUE) |
View README.md
View thread_pool.rb
class ThreadPool | |
def self.execute(objects:, method:, pool: 5) | |
new(objects: objects, method: method, pool: pool).execute | |
end | |
def initialize(objects:, method:, pool:) | |
@objects = objects | |
@method = method | |
@pool = pool | |
@queue = queue |
View clone-github-user.rb
#!/usr/bin/env ruby | |
require 'tty-prompt' | |
require 'open-uri' | |
require 'json' | |
require 'colorize' | |
require 'colorized_string' | |
prompt = TTY::Prompt.new | |
user_name = prompt.ask("What is name of the user or organisation?") |
View README.md
this script will read every line (file path) passed to it, then shows the last commit message and time (human readable period), you can use it to see who added png images and when to your project for example:
git ls-files | grep png | git-last-commit
you can get some results similar to the following:
images/screenshot.png
digitalcraftsman: Updated screenshots -- 3 years, 11 months ago
View cleaned_rails
. | |
├── app | |
│ ├── assets | |
│ │ ├── config | |
│ │ │ └── manifest.js | |
│ │ ├── images | |
│ │ ├── javascripts | |
│ │ │ └── application.js | |
│ │ └── stylesheets | |
│ │ └── application.css |
NewerOlder