Skip to content

Instantly share code, notes, and snippets.

View meddle0x53's full-sized avatar
🏠
Working from home

meddle meddle0x53

🏠
Working from home
View GitHub Profile
@andkirby
andkirby / slack.sh
Last active June 5, 2024 09:55
Shell/Bash script for sending slack messages.
#!/usr/bin/env bash
####################################################################################
# Slack Bash console script for sending messages.
####################################################################################
# Installation
# $ curl -s https://gist.githubusercontent.com/andkirby/67a774513215d7ba06384186dd441d9e/raw --output /usr/bin/slack
# $ chmod +x /usr/bin/slack
####################################################################################
# USAGE
# Send message to slack channel/user
defmodule RubyServer do
use GenServer
def start_link(opts \\ []) do
GenServer.start_link(__MODULE__, nil, opts)
end
def cast(server, cmd) do
GenServer.cast(server, {:cast, cmd})
end
cmd = ~S"""
ruby -e '
require "bundler"
require "erlang/etf"
require "stringio"
@input = IO.new(3)
@output = IO.new(4)
@output.sync = true
cmd = ~S"""
ruby -e '
require "bundler"
require "erlang/etf"
require "stringio"
STDOUT.sync = true
def receive_input
encoded_length = STDIN.read(4)
cmd = ~S"""
ruby -e '
STDOUT.sync = true
def receive_input
encoded_length = STDIN.read(4)
return nil unless encoded_length
length = encoded_length.unpack("N").first
STDIN.read(length)
cmd = ~S"""
ruby -e '
STDOUT.sync = true
context = binding
while (cmd = gets) do
eval(cmd, context)
end
'
"""
anonymous
anonymous / backup.sh
Created March 11, 2014 10:58
backup my ssd disk to normal disk
#!/bin/bash
/usr/bin/rsync -r -t -p -o -g -x --delete --size-only -l -s --exclude-from=/home/guda/bin/ssd_backup_exclude.txt /home/guda/ /home/guda/external/backup