Skip to content

Instantly share code, notes, and snippets.

View ybur-yug's full-sized avatar

yburyug ybur-yug

View GitHub Profile
cmd = ~S"""
ruby -e '
require "bundler"
require "erlang/etf"
require "stringio"
require "sinatra"
@input = IO.new(3)
@output = IO.new(4)
@output.sync = true
TOP_5=`(history | awk '{print $2}' | sort | uniq -c | sort -rn | head -n 5)`
for score in `echo $TOP_5 | xargs`; do
# command="$(echo $score | awk '{print $2}' | tr -d '\n')"
score="$(echo $score | awk '{print $1}' | tr -d '\n')"
num_hashes="$(echo $score | awk '{print $1 / 25}' | awk -F. '{print $1}')"
hashes="$(jot -b '#' - 1 $num_hashes | xargs | tr -d ' ')"
echo "$hashes"
done
######################################################################################################################
##
#!/bin/sh
# Reboot netgear CM400 cablemodem via curl
curl -s -u admin:password 'http://192.168.100.1'$(curl -s -u admin:password http://192.168.100.1/RouterStatus.htm | grep id=[0-9] | cut -d'"' -f2) --data 'buttonSelect=2&wantype=dhcp&enable_apmode=0' > /dev/null
defmodule Image do
defstruct [:grid, :pixel_map]
end
defmodule RandomImageGenerator do
def create(width, bar_size, filename \\ "out.png") do
%Image{}
|> create_grid(width)
|> build_pixel_map(width, bar_size)
" FIXME if it is your first time with this vimrc then run
" # git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
# list the flags for `ls` that are NOT valid flags
man ls | ruby -n -e 'puts $_ if $_.include? " -"' | ruby -n -e 'a = $_.split(" "); puts a[1]' | ruby -n -e 'puts $_ if $_.include?("-")' > args && ruby -e 'puts http://File.read ("args").split("\n")[0..38]' > args2 && ruby -e 'puts ("a".."z").to_a - http://File.read ("args2").split("\n").map { |el| el.split("")[3] }'
#!/bin/bash
function calculate_stats() {
mkdir priv
mkdir priv/scripts
echo "Gathering stats for umbrella project..."
echo
APPS_COUNT=$(ls apps | wc -l)
echo $(echo "$APPS_COUNT Apps")
echo
@ybur-yug
ybur-yug / bot_protector.rb
Created May 2, 2017 23:44 — forked from Oshuma/bot_protector.rb
Rack middleware to fuck with bot requests.
module NerdNode
# Rack app to reject common bot attacks. Returns a random HTTP status and content type, along with some LOLs.
#
# Usage:
# use NerdNode::BotProtector, /phpmyadmin\/scripts|mysql\/scripts/
#
# # ...or use the Regexp helper which takes an array of URL strings...
# blacklist = BotProtector.build_regex(['phpmyadmin/scripts', 'mysql/scripts'])
# use NerdNode::BotProtector, blacklist
#
defmodule Services.SchemaCase do
use ExUnit.CaseTemplate
using(opts) do
quote bind_quoted: [opts: opts] do
alias Services.Repo
import Ecto
import Ecto.Changeset
import Ecto.Query
a_big_map = %{a: 1,
b: 1,
c: 1,
d: 1,
ea: 1,
fa: 1,
ga: 1,
fa: 1,
frgwa: 1,
fbwa: 1,