Skip to content

Instantly share code, notes, and snippets.

@graninas
graninas / haskell_design_showcase_projects.md
Last active March 29, 2024 14:43
Software Design Showcase Projects in Haskell

Software Design Showcase Projects in Haskell

(WIP)

  • Automatic White-Box Testing with Free Monads | Alexander Granin
    • Description: Article and showcase project about an approach to whitebox testing. Describes the idea of recordable and replayable business scenarios based on the Free Monad approach.
    • Design Approach: [Free Monads]
    • Technologies: [free, aeson]
    • Teaches for: How to make a Free monad based business logic recordable and replayable. How to use the recordings for automatic whitebox testing. How to configure this system to do integration testing.
@alexpchin
alexpchin / Setting_upa_new_repo.md
Last active March 29, 2024 14:42
Create a new repository on the command line

Setting up a new Git Repo

##Create a new repository on the command line

touch README.md
git init
git add README.md
git commit -m "first commit"

git remote add origin git@github.com:alexpchin/.git

@unixzii
unixzii / trapping_rain_water_tmp.cc
Last active March 29, 2024 14:38
A "Trapping Rain Water" implementation using C++ template metaprogramming.
template <int, typename>
struct List;
struct Nil {
template <int _NValue>
using Append = List<_NValue, Nil>;
};
template <int _Value, typename _Next>
struct List {
@Yegorov
Yegorov / ya.py
Created January 13, 2018 16:08
Download file from Yandex.Disk through share link
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# https://toster.ru/q/72866
# How to
# wget http://gist.github.com/...
# chmod +x ya.py
# ./ya.py download_url path/to/directory
import os, sys, json
@rene-d
rene-d / colors.py
Last active March 29, 2024 14:34
ANSI color codes in Python
# SGR color constants
# rene-d 2018
class Colors:
""" ANSI color codes """
BLACK = "\033[0;30m"
RED = "\033[0;31m"
GREEN = "\033[0;32m"
BROWN = "\033[0;33m"
BLUE = "\033[0;34m"
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active March 29, 2024 14:32
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- 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%'
@ravijo
ravijo / pdf2jpg_recursive.sh
Last active March 29, 2024 14:32
This shell script converts all PDF files to JPG files
#!/bin/bash
# author: ravi joshi
# date: 19 mar 2020
# this shell script converts all PDF files to JPG files
# it walks recursively inside the given directory
# requirement: it uses ImageMagick command line tool for PDF to JPG convertion.
# check here (https://github.com/ravijo/image-video-editing#install-imagemagick-on-ubuntu-1404)
# for more information
if [ $# -eq 0 ]; then
@gustavohenrique
gustavohenrique / telnet-imap
Created June 6, 2013 14:00
playing with gmail via telnet
openssl s_client -crlf -connect imap.gmail.com:993
tag login user@gmail.com passwordhere
tag list "" "*"
tag select "inbox"
tag fetch 1:3 body[header]
tag fetch 3 body[header]
tag fetch 3 body[text]
tag fetch 2 all
tag fetch 2 fast
tag fetch 2 full
@import url("https://fonts.googleapis.com/css?family=Roboto+Slab:100,300,400,700");
@import url("https://fonts.googleapis.com/css?family=Raleway:300,300i,400,400i,500,500i,600,600i,700,700i,800,800i,900,900i");
* {
margin: 0;
border: 0;
box-sizing: border-box;
}
:root {
@the-spyke
the-spyke / pipewire.md
Last active March 29, 2024 14:25
Enable PipeWire on Ubuntu 22.04

Enable PipeWire on Ubuntu 22.04

This guide is only for original Ubuntu out-of-the-box packages. If you have added a custom PPA like pipewire-debian, you might get into conflicts.

Ubuntu 22.04 has PipeWire partially installed and enabled as it's used by browsers (WebRTC) for recoding the screeen under Wayland. We can enable remaining parts and use PipeWire for audio and Bluetooth instead of PulseAudio.

Starting from WirePlumber version 0.4.8 automatic Bluetooth profile switching (e.g. switching from A2DP to HSP/HFP when an application needs microphone access) is supported. Jammy (22.04) repos provide exactly version 0.4.8. So, we're good.

Based on Debian Wiki, but simplified for Ubuntu 22.04.