Skip to content

Instantly share code, notes, and snippets.

View catwell's full-sized avatar

Pierre Chapuis catwell

View GitHub Profile

Various search databases and backends as alternatives to Elasticsearch.

Rust

Let's see how to post a message with a Slack bot, using Bearer.sh.

Steps

  1. Create a custom API on Bearer.sh dashboard (learn how here).
  2. Use the configuration below for that custom API
  3. Create a Slack bot on Slack (link)
  4. Register the Bot API Key on Bearer (it starts with xoxb-...)
  5. Post to a channel using the snippet below
@ericwbailey
ericwbailey / twitter.css
Last active September 18, 2023 19:09
Stylus tweaks to fix Twitter's desktop web UI. #twitter #stylus
/*
* LOGO
*/
[aria-label="Twitter"] {
display: none;
}
/*
* LEFT COLUMN
anonymous
anonymous / untrusted-lvl7-solution.js
Created July 26, 2015 17:42
Solution to level 7 in Untrusted: http://alex.nisnevich.com/untrusted/
/*************
* colors.js *
*************
*
* You're almost at the exit. You just need to get past this
* color lock.
*
* Changing your environment is no longer enough. You must
* learn to change yourself. I've sent you a little something
* that should help with that.
anonymous
anonymous / untrusted-lvl6-solution.js
Created July 26, 2015 17:36
Solution to level 6 in Untrusted: http://alex.nisnevich.com/untrusted/
/****************
* drones101.js *
****************
*
* Do you remember, my dear Professor, a certain introductory
* computational rationality class you taught long ago? Assignment
* #2, behavior functions of autonomous agents? I remember that one
* fondly - but attack drones are so much easier to reason about
* when they're not staring you in the face, I would imagine!
anonymous
anonymous / untrusted-lvl5-solution.js
Created July 26, 2015 17:30
Solution to level 5 in Untrusted: http://alex.nisnevich.com/untrusted/
/******************
* minesweeper.js *
******************
*
* So much for Asimov's Laws. They're actually trying to kill
* you now. Not to be alarmist, but the floor is littered
* with mines. Rushing for the exit blindly may be unwise.
* I need you alive, after all.
*
* If only there was some way you could track the positions
@aseemk
aseemk / README.md
Last active February 14, 2018 16:41
A bookmarklet for "selecting all" (technically, "toggling all") checkboxes on the Amazon AWS S3 console.
@alex
alex / Original lyrics
Created October 1, 2012 04:23
I'm proud to be a unix programmer
If tomorrow all the things were gone,
I’d worked for all my life.
And I had to start again,
with just my children and my wife.
I’d thank my lucky stars,
to be livin here today.
‘ Cause the flag still stands for freedom,
and they can’t take that away.
@mildmojo
mildmojo / left_join_arel_example.rb
Last active April 5, 2024 16:00
LEFT JOIN in ARel for ActiveRecord in Ruby on Rails
# Here's a contrived example of a LEFT JOIN using ARel. This is an example of
# the mechanics, not a real-world use case.
# NOTE: In the gist comments, @ozydingo linked their general-purpose ActiveRecord
# extension that works for any named association. That's what I really wanted!
# Go use that! Go: https://gist.github.com/ozydingo/70de96ad57ab69003446
# == DEFINITIONS
# - A Taxi is a car for hire. A taxi has_many :passengers.
# - A Passenger records one person riding in one taxi one time. It belongs_to :taxi.
@mislav
mislav / easy_way.rb
Last active May 20, 2020 13:48
RESOLVE SHORT URLS before storing. Short URLs are for microblogging; you should never actually keep them around.
require 'net/http'
# WARNING do not use this; it works but is very limited
def resolve url
res = Net::HTTP.get_response URI(url)
if res.code == '301' then res['location']
else url.to_s
end
end