Skip to content

Instantly share code, notes, and snippets.

View mraaroncruz's full-sized avatar
🏃‍♂️

Aaron Cruz mraaroncruz

🏃‍♂️
View GitHub Profile
@mraaroncruz
mraaroncruz / steps.md
Last active April 16, 2024 07:22
Get the Telegram channel ID

To get the channel id

  1. Create your bot with botfather
  2. Make you bot an admin of your channel

Simplest way (via @anhtuank7c)

Go to Telegram web and open a channel, get the ID from -[channel id] from hash in the path

https://web.telegram.org/k/#-9999999999999

@mraaroncruz
mraaroncruz / working_webserver.livemd
Created September 1, 2022 23:22
A livebook with a running http server that can accept requests

Working webserver

Mix.install([
  {:plug_cowboy, "> 0.0.0"},
  {:jason, "> 0.0.0"},
  {:httpoison, "> 0.0.0"}
])
@mraaroncruz
mraaroncruz / install.md
Last active April 14, 2023 15:10
Install older OTP versions when you have OpenSSL version >= 3.0

There is an issue with openssl < 3.0 and most versions of Erlang

To fix, install openssl into some directory

cd /usr/local/src
sudo mkdir openssl
sudo chown username:staff openssl
cd openssl
git clone git://git.openssl.org/openssl.git
@mraaroncruz
mraaroncruz / foo.ex
Created August 17, 2022 13:00
ExUnit.run()
ExUnit.start(auto_run: false)
defmodule CalculatorTest do
use ExUnit.Case, async: false
describe "Testing the addition function" do
test "2 plus 3 is 5" do
assert 2 + 2 == 5
end
end
end
@mraaroncruz
mraaroncruz / a_foursquare_categories_to_markdown.rb
Last active April 14, 2022 15:45
list of foursquare categories and ids
require 'json'
require 'net/http'
require 'uri'
#### USE ############################################################################
#
# ruby foursquare_categories.rb MYOAUTHTOKEN > foursquare_categories.md
#
# or if you have the markdown utility installed
#
@mraaroncruz
mraaroncruz / JSONB.go
Created June 8, 2016 12:33
JSONB for postgres in Golang
// Found in this issue thread https://github.com/jinzhu/gorm/issues/516#issuecomment-109055198
// License unknown
//
//
// Postgres' JSONB type. It's a byte array of already encoded JSON (like json.RawMessage)
// which also saves itself correctly to PG's jsonb type. It would probably also work on
// PG json types.
type JSONB []byte
func (j JSONB) Value() (driver.Value, error) {
@mraaroncruz
mraaroncruz / mltframework_packages.sh
Created October 22, 2012 13:28
Installation of OBE
[2012-10-22T15:29:32+02:00] INFO: Processing package[ffmpeg] action install (mlt::default line 10)
[2012-10-22T15:29:54+02:00] INFO: package[ffmpeg] installed version 6:0.8.3-6ubuntu2
[2012-10-22T15:29:54+02:00] INFO: Processing package[automake] action install (mlt::default line 10)
[2012-10-22T15:29:54+02:00] INFO: Processing package[autoconf] action install (mlt::default line 10)
[2012-10-22T15:29:54+02:00] INFO: Processing package[libtool] action install (mlt::default line 10)
[2012-10-22T15:29:54+02:00] INFO: Processing package[intltool] action install (mlt::default line 10)
[2012-10-22T15:29:54+02:00] INFO: Processing package[g++] action install (mlt::default line 10)
[2012-10-22T15:29:54+02:00] INFO: Processing package[yasm] action install (mlt::default line 10)
[2012-10-22T15:29:54+02:00] INFO: Processing package[swig] action install (mlt::default line 10)
[2012-10-22T15:29:54+02:00] INFO: Processing package[libmp3lame-dev] action install (mlt::default line 10)
@mraaroncruz
mraaroncruz / claymore-dualminer-api.md
Last active July 20, 2021 17:34
Ethminer API Docs (lol) and some other miner APIs

EthMan uses raw TCP/IP connections (not HTTP) for remote management and statistics. Optionally, "psw" field is added to requests is the password for remote management is set for miner. The following commands are available (JSON format):


REQUEST: {"id":0,"jsonrpc":"2.0","method":"miner_getstat1"}

RESPONSE:

@mraaroncruz
mraaroncruz / butter-chicken.md
Last active March 18, 2021 18:45
Butter chicken recipe

Ingredients

  • 2 Chicken Breasts small chunks
  • 3 EL butter
  • 10 small tomatoes (or 1 cup tomato sauce)
  • 1 cup tomato sauce
  • 1 onion (medium cubes)
  • 3 cloves garlic (smashed)
  • 2 EL Ginger (or ginger puree)
  • 30g Cashews (a handful?) (I also used some peeled almonds but whatever you have I guess)
@mraaroncruz
mraaroncruz / solr_client.ex
Created February 15, 2021 10:33
Quick implementation of a Solr client in Elixir
defmodule MyApp.Search.SolrClient do
require Logger
def url, do: Application.get_env(:my_app, :solr)[:url]
def select_url(url), do: "#{url}/select"
def update_url(url), do: "#{url}/update"
def update_json_url(url), do: "#{url}/update/json/docs"
def select(params) when is_list(params) do