Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View alhassy's full-sized avatar

Musa Al-hassy alhassy

View GitHub Profile
@JenChampagne
JenChampagne / matviews.sql
Created March 25, 2022 17:55
Some basics of working with Materialized Views in PostgreSQL
-- create any table to use as a test dataset
create table test_data (
id serial not null primary key,
data jsonb not null
);
-- insert some data!
insert into test_data (data) values ('{}');
insert into test_data (data) values ('{}');
@codecoll
codecoll / convert.el
Created April 8, 2020 07:44
Conversion of seconds to hours minutes seconds string in elisp
(let* ((secs 100)
(hours (/ secs 3600))
(minutes (/ (% secs 3600) 60))
(seconds (% secs 60)))
(format "%s%s%s"
(if (> hours 0)
(format "%sh " hours)
"")
(if (> minutes 0)
(format "%sm " minutes)
# feature: Add beta sequence.
# ^-----^ ^----------------^
# | |
# | +-> Summary in present tense sentence.
# |
# +-------> Type: binary, chore, doc, excise, feature, fix, hack, legal, refactor,
# style, or test.
@yogthos
yogthos / clojure-beginner.md
Last active April 22, 2024 09:00
Clojure beginner resources

Introductory resources

@emilyhorsman
emilyhorsman / Instructions.org
Last active February 10, 2019 00:12
Literate Agda in Org mode documents

Literate Agda in Org mode documents

Note: These instructions will be unnecessary after Agda 2.6.0 is released.

PR agda/adga#3548.

  1. Clone the Agda repository.
    git clone https://github.com/agda/agda.git
    cd agda
        
(require 'dash)
(require 's)
(require 'loop)
(require 'icons-in-terminal)
(defun my-char-at-point (&optional p)
"P."
(let ((point (or p (point))))
(if (< point (point-max)) (buffer-substring-no-properties point (1+ point))
"")))
@andrewthad
andrewthad / age_riddle.hs
Created April 21, 2017 17:19
Age Riddle
-- This is a riddle about people's ages that I made up. Below, we solve it
-- using the monadic interface to lists. Here it is:
--
-- * Jordan is either 13 years old or 16 years old
-- * Shen is between 3 and 5 years older than Jordan (inclusive bounds)
-- * Claudia is between 6 and 9 years younger than Jordan's age plus Shen's age.
-- * I am as old as the three aforementioned people combined.
--
-- Given the provided information, I could have many possible ages. The monad
-- instance for list models this kind of nondeterminism well. Run the example
@r-brown
r-brown / howto-install-jekyll_homebrew-rbenv.txt
Last active June 12, 2022 15:23
How to install Jekyll using Homebrew and rbenv
# install Homebrew
$ su ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# show brew commands
$ brew help
# check current user
$ echo $(whoami)
# grant access to the folders
@domenic
domenic / 0-github-actions.md
Last active April 8, 2024 23:35
Auto-deploying built products to gh-pages with Travis

Auto-deploying built products to gh-pages with GitHub Actions

This is a set up for projects which want to check in only their source files, but have their gh-pages branch automatically updated with some compiled output every time they push.

A file below this one contains the steps for doing this with Travis CI. However, these days I recommend GitHub Actions, for the following reasons:

  • It is much easier and requires less steps, because you are already authenticated with GitHub, so you don't need to share secret keys across services like you do when coordinate Travis CI and GitHub.
  • It is free, with no quotas.
  • Anecdotally, builds are much faster with GitHub Actions than with Travis CI, especially in terms of time spent waiting for a builder.
@danielsnider
danielsnider / xmonad.h
Created June 18, 2014 20:04
Xmonad config with gnome panel and programs which open and move to specific workspaces by default
import XMonad
import XMonad.Config.Gnome
import qualified XMonad.StackSet as W
spawnToWorkspace :: String -> String -> X ()
spawnToWorkspace program workspace = do
spawn program
windows $ W.greedyView workspace