Skip to content

Instantly share code, notes, and snippets.

View chendo's full-sized avatar

chendo chendo

View GitHub Profile
#!/bin/bash
read -p "Enter in part of public ssh key to search: " key
for f in `cut -d : -f 6 /etc/passwd`; do grep -nHs $key $f/.ssh/authorized_keys; done;
#!/bin/bash
# Disclaimer: my first bash script
# User purger - removes the user and their public keys from a system
# By chendo
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
exit 1
fi
# Rack::SimpleServer
#
# a small rack app that acts like a basic HTTP server
# github.com/chendo
#
# Options:
# * :root => directory to expose
# e.g., use Rack::SimpleServer, :root => 'pub'
module Rack
# Symbol to Proc is a mutha' fucking dirty hack. It brings the indirection
# that we hated from Pearl to Ruby. How it made it into core I don't know.
# Anyway, rather than bitch and moan too much, here is an alternative method
# which is much more expressive and has the same number of characters. The
# name pick comes from Rebol, though it functions more like select there.
# Benchmark:
# user system total real
# 0.200000 0.000000 0.200000 ( 0.212325)
# 0.470000 0.000000 0.470000 ( 0.475471)
window.Widget.Trending: class TrendingWidget extends Widget
constructor: (config) ->
Widget.Trending.instance: this
@template: """
<div class='widget small trending'>
<ul>
{{#topics}}
<li class='down'>{{name}}</li>
{{/topics}}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Twitter</title>
<link rel="stylesheet" href="/stylesheets/main.css" type="text/css" media="screen" title="no title" charset="utf-8" />
</head>
<body>
When /^I fill in "([^\"]*)" with:$/ do |field, string|
fill_in(field, :with => string)
end
Then /^I should not see a "([^\"]*)" button$/ do |button_name|
lambda {
When %Q{I press "#{button_name}"}
}.should raise_error(Capybara::ElementNotFound)
end
# Daft Golf
# by chendo
# 484 bytes
s=%w(after better do ever faster harder hour is it make makes more never our over stronger than us work)
m="chavnohzy3a7uvnb4iw21ogt3xwazyiw6gqsoaihdjw36q8encnd1oxfpy2eomjfxfr9"
n="5vjlr1vcd8f7rdjb3c3zfk0kh6cjxc2l8dzvzk2hhfrwkg2n2ln04mpli1tq5gnfu7nvxc6dbk8yq9uxnfboimh5902mqtggizhhaakr2nk2xsh4qar5b8aypdocmeakqelscg11evw57i3ttep2ott0pqteclmae5sckhc"
def d(e,a)
t=e.to_i(36).to_s(2)
t[0]=''
t.scan(/.{5}/).map{|b|a[b.to_i(2)]}
# Counts CSS selectors for a file
File.read('public/stylesheets/ranger2.css').gsub(%r{/\*.*?\*/}m, '').split(/\{.*?\}/m).map { |s| s.strip.split(/,/) }.flatten.size
# Run with this:
# $ curl "https://gist.github.com/raw/748530/5e74315dc6b6fe572f8a457536ad7eb17ad3f1e4/a.rb" > a.rb; while true; do clear; ruby a.rb | tee b.rb; sleep 0.3; mv -f b.rb a.rb; done
# Source: http://mamememo.blogspot.com/2010/09/qlobe.html
v=0000;eval$s=%q~d=%!^Lcf<LK8, _@7gj*LJ=c5nM)Tp1g0%Xv.,S[<>YoP
4ZojjV)O>qIH1/n[|2yE[>:ieC "%.#% :::##" 97N-A&Kj_K_><wS5rtWk@*a+Y5
yH?b[F^e7C/56j|pmRe+:)B "##% ::##########" O98(Zh)'Iof*nm.,$C5Nyt=
PPu01Avw^<IiQ=5$'D-y? "##: ###############" g6`YT+qLw9k^ch|K'),tc
6ygIL8xI#LNz3v}T=4W "# #. .####:#######" lL27FZ0ij)7TQCI)P7u
}RT5-iJbbG5P-DHB<. " ##### # :############" R,YvZ_rnv6ky-G+4U'