Skip to content

Instantly share code, notes, and snippets.

View bmarkons's full-sized avatar
💨

Marko Bogdanović bmarkons

💨
View GitHub Profile
words = File.read!("input.txt") |> String.split
defmodule A do
def get(words, beginning, sequence) do
if words[beginning] do
words[beginning] |> Enum.filter(fn word ->
!Enum.member?(sequence, word)
end)
end
end
@bmarkons
bmarkons / kaladont.rb
Created November 20, 2021 21:56
Finding longest kaladont sequence
words = File.read("input.txt").split
def get(words, beginning, sequence)
words[beginning].select { |word| !sequence.include?(word) } if words[beginning]
end
def kalodont(words, sequence)
selected_words = get(words, sequence.last[-2..-1], sequence)
if selected_words && !selected_words.empty?
@bmarkons
bmarkons / gist:5bf80b97ac4f5860f903c60cbbe3540d
Created October 5, 2021 19:38 — forked from jampajeen/gist:d19f36a7309d0ead0e1f9735a26d66f3
Disable/Enable Mac OSX sleep on lid closed
# disable sleep
sudo pmset -b sleep 0; sudo pmset -b disablesleep 1
# re-enable sleep
sudo pmset -b sleep 5; sudo pmset -b disablesleep 0
{
"push": {
"changes": [
{
"forced": false,
"old": {
"name": "master",
"links": {
"commits": {
"href": "https://api.bitbucket.org/2.0/repositories/bmarko021/test/commits/master"
@bmarkons
bmarkons / node
Last active December 17, 2020 14:57
# Install node lts version
curl -sL install-node.now.sh/lts | sudo bash
Opis ideje za sajt za prikaz zemalja u koje mogu putovati srpski državljani za vreme covid-19 pandemije.
- Skrejpuj http://www.mfa.gov.rs/sr/index.php/konzularni-poslovi/putovanja-u-inostranstvo/vesti-za-putovanja-u-inostranstvo/22669-----------covid-19?lang=lat
- Stavi u tabelu po zemljama sa kolonama MOZE / NE MOZE
- Odredi da li se moze na osnovu prve recenice (ako prva recenica sadrzi 'moze' onda se moze, ako sadrzi 'ne moze' onda se ne moze)
- Omoguci opciju za prikaz celokupnog teksta za odredjenu drzavu
- Omoguci subscribe na odredjenu zemlju
@bmarkons
bmarkons / postgres_queries_and_commands.sql
Last active October 8, 2020 14:24 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- kill running query
SELECT pg_cancel_backend(procpid);
-- kill idle query
@bmarkons
bmarkons / dock-launcher
Created November 26, 2017 12:46
Dock Ubuntu launcher to the bottom of the screen
# Dock to the bottom
gsettings set com.canonical.Unity.Launcher launcher-position Bottom
# Dock to the left
gsettings set com.canonical.Unity.Launcher launcher-position Left
# Source
https://www.howtogeek.com/251616/how-to-move-the-unity-desktops-launcher-to-the-bottom-of-your-screen-on-ubuntu-16.04/
@bmarkons
bmarkons / mouse_speed.sh
Last active November 30, 2020 12:11
Boost mouse speed on iMac
# Stolen from here https://www.tylernichols.com/apple/speed-up-mouse-tracking-on-mac-os-x
defaults write -g com.apple.mouse.scaling 6.0
# Boost keyboard speed
defaults write NSGlobalDomain KeyRepeat -int 1
@bmarkons
bmarkons / gsoc2017.md
Last active August 13, 2018 21:48
Google Summer of Code 2017 - summary

Google Summer of Code 2017 - Long Running Ruby and Rails Benchmarks

Organization
Project Long Running Ruby and Rails Benchmarks