Skip to content

Instantly share code, notes, and snippets.

View akirill0v's full-sized avatar

Alexander Kirillov akirill0v

View GitHub Profile
@akirill0v
akirill0v / nix-on-macos-catalina.md
Created December 22, 2021 19:45 — forked from chriselsner/nix-on-macos-catalina.md
Nix on macOS Catalina

Nix on macOS Catalina

I'm writing this gist for my own records but it might help someone else too.

Installing Nix

Support for Catalina has improved a lot since the update was first rolled out.

Note: See the NixOS manual for discussion of the --darwin-use-unencrypted-nix-store-volume option.

# Instructions for fresh install
$ sh <(curl -L https://nixos.org/nix/install) --darwin-use-unencrypted-nix-store-volume --daemon
# reboot
$ source /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
$ echo 'export NIX_PATH=darwin-config=$HOME/.nixpkgs/darwin-configuration.nix:$HOME/.nix-defexpr/channels${NIX_PATH:+:}$NIX_PATH' | tee -a ~/.zshrc
$ echo 'source $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh' | tee -a ~/.zshrc
$ nix-channel --add https://nixos.org/channels/nixpkgs-unstable
$ nix-channel --add https://github.com/LnL7/nix-darwin/archive/master.tar.gz darwin
$ nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
@akirill0v
akirill0v / postgres_queries_and_commands.sql
Created October 5, 2020 18:19 — forked from rgreenjr/postgres_queries_and_commands.sql
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%'
@akirill0v
akirill0v / find-rls-preview.sh
Created May 7, 2019 09:37 — forked from MadratJerry/find-rls-preview.sh
Find the latest rust nightly version with rls-preview
#!/bin/bash
MAC=false
date -r "$now" +%Y-%m-%d &> /dev/null
if [ "$?" -ne "0" ]; then echo "LINUX"; MAC=false; else echo 'MAC'; MAC=true; fi
now=`date +%s`
while true
do
if [ "$MAC" == "true" ]; then data=`date -r "$now" +%Y-%m-%d`; else data=`date -d @"$now" +%Y-%m-%d`; fi
class BasketController
def add_to_basket
item = Item.find_by_title(params[:item_title])
basket = $basket
basket.add_item(item)
if basket.count_items > 10
basket.error_messages.add("Слишком много товаров в корзине")

Chromium OS ft. Docker

Chromium OS is cool. Chromium OS with crouton is cooler. Chromium OS with Docker is even cooler. This is specifically a guide for the HP Chromebook 13 G1 (aka HP Spyder Chromebook), but I can't think of any reason it wouldn't work with other devices. The Chromebook Pixel 2 (2015), for example...as you'll notice, the guide this was forked from assumed that machine.

  1. Create a build environment
  2. Customize the kernel
  3. Build Chromium OS
  4. Flash Chromium OS to USB
  5. Install Chromium OS
@akirill0v
akirill0v / MIT-LICENSE-template
Created January 23, 2019 12:19
A template to make good README.md
MIT License
Copyright (c) [year||from_year-to_year] [author's fullname]
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@akirill0v
akirill0v / .pre-commit.sh
Created May 23, 2018 11:19 — forked from glfmn/.pre-commit.sh
Template pre-commit script for running tests on Rust projects especially, but appropriate for any project.
#!/usr/bin/env sh
# pre-commit.sh
STASH_NAME="pre-commit-$(date +%s)"
ROOT_DIR="$(git rev-parse --show-toplevel)"
BUILD_DIR="${ROOT_DIR}/target"
BRANCH_NAME=$(git branch | grep '*' | sed 's/* //')
RED='\033[1;31m'
GREEN='\033[1;32m'
YELLOW='\033[1;33m'
@akirill0v
akirill0v / add-new-crypto-to-peatio.md
Created October 24, 2017 07:04 — forked from brossi/add-new-crypto-to-peatio.md
Adding A New Cryptocurrency to Peatio

State: Draft
Based on the Peatio Stable branch


Coin Daemon

To the coin daemon's {coin}.conf file, include the -walletnotify command:

# Notify when receiving coins
@akirill0v
akirill0v / vexor.yml
Last active September 7, 2017 13:48 — forked from ekorneeff/vexor.yml
language: ruby
rvm:
- 2.2.2
database:
- cp mongoid.yml.example mongoid.yml
- bundle exec db:create db:migrate
services:
- redis