Skip to content

Instantly share code, notes, and snippets.

View duksis's full-sized avatar
🇪🇺
I definitely will be slow to respond.

Hugo Duksis duksis

🇪🇺
I definitely will be slow to respond.
View GitHub Profile
@duksis
duksis / unix_cheat_sheet.md
Last active March 26, 2025 07:37
Unix cheat sheet

Add your ssh key to a remote server

ssh-copy-id user@remote

Copy files from one remote to another

scp user@source:/path/to/file user@target:/path/to/file
@duksis
duksis / ubuntu_ruby_install_notes.md
Last active January 21, 2025 12:31
install ruby 3.4.1 on Ubuntu 24.04.1 LTS (WSL)
sudo apt install build-essential
sudo apt install zlib1g-dev
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.15.0
asdf plugin add ruby https://github.com/asdf-vm/asdf-ruby.git
sudo apt-get update
sudo apt-get -y install libffi-dev libyaml-dev
asdf install ruby 3.4.1
@duksis
duksis / bsky_app_click_follow_btn.js
Created December 19, 2023 17:11
Click every (loaded) Follow button on the current bsky.app page
var buttons = document.querySelectorAll('button > div > div'); for (let i = 0; i < buttons.length; i++) {
buttons[i].textContent === 'Follow' ? buttons[i].click() : false;
}
@duksis
duksis / test.sh
Created September 25, 2019 20:46
curl 'https://gql.example.com/v1' \
-d '{"query": "query($id:Int!) user(id: $id) { name }", "variables": {"id": 1}}'
@duksis
duksis / whys_in_best_practices.md
Created February 15, 2017 09:12
Why's in Best Practices [rails migrations]

Why's in best practices

In software development there are loads of "Best practices" or suggestions what to do and what not in order to come to a better result.

For most of the cases you will be better of by just folowing these suggestions and for the rest it's very handy to understand why these suggestions exist.

@duksis
duksis / whys_in_best_practices.md
Created February 15, 2017 09:09
Why's in best practices [rails migrations]

Why's in best practices

In software development there are loads of "Best practices" or suggestions what to do and what not in order to come to a better result.

For most of the cases you will be better of by just folowing these suggestions and for the rest it's very handy to understand why these suggestions exist.

# helper function for creating double modules
# with function `call` returning initially provided data
#
# argument exampes:
# name = SomeModuleTest.ForTestCase
# data = [%{"some" => "data"}]
def create_double_module(name, data) do
contents = quote do
def call(_module, _fun, _args) do
@duksis
duksis / pixi-basic-honeypot.js
Last active January 24, 2023 22:13
Pixi.js basic example with a rotating Honeypot
var renderer = PIXI.autoDetectRenderer(750, 600,{backgroundColor : 0x1099bb});
document.getElementById("rotating-honeypot").appendChild(renderer.view);
// create the root of the scene graph
var stage = new PIXI.Container();
// create a texture from an image path
var texture = PIXI.Texture.fromImage('../assets/images/mascot.png');
// create a new Sprite using the texture
@duksis
duksis / gist:3a722a0a2dead78afd01
Created May 27, 2015 21:53
heroku-buildpack-elixir not working with Erlang R16B
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Fetching custom git buildpack... done
remote: -----> elixir app detected
remote: -----> Checking Erlang and Elixir versions
remote: Will use the following versions:
remote: * Stack cedar-14
remote: * Erlang R16B
remote: * Elixir 0.10.2
@duksis
duksis / deep_foldl_test.exs
Last active August 29, 2015 14:15
Elixir deep_foldl
# # https://gist.github.com/ashneyderman/5c88439c68b19ecf50d5
# @type reducer :: (term, term -> term)
# @spec deep_foldl(list, term, reducer) :: term
#
# ## deep folds should accept arbitrarily deep nested lists
# ## it should call the fun on anything which is not a list.
# ## For a flat list, it should do the same thing as erlang's
# ## lists:foldl/3.
#
# 15 = deep_foldl([[1,[2,[3,[4,5]]]]], 0, fn(N,Sum) -> N+Sum end).