Skip to content

Instantly share code, notes, and snippets.

View ykhrustalev's full-sized avatar

Yuri Khrustalev ykhrustalev

View GitHub Profile
@ykhrustalev
ykhrustalev / LocalStorage.ts
Created March 25, 2018 13:48 — forked from picode7/ LocalStorage.ts
LocalStorage TypeScript Module
/**
* Check if localStorage is supported const isSupported: boolean
* Check if localStorage has an Item function hasItem(key: string): boolean
* Get the amount of space left in localStorage function getRemainingSpace(): number
* Get the maximum amount of space in localStorage function getMaximumSpace(): number
* Get the used space in localStorage function getUsedSpace(): number
* Get the used space of an item in localStorage function getItemUsedSpace(): number
* Backup Assosiative Array interface Backup
* Get a Backup of localStorage function getBackup(): Backup
* Apply a Backup to localStorage function applyBackup(backup: Backup, fClear: boolean = true, fOverwriteExisting: boolean = true)
use std::iter::FromIterator;
impl std::fmt::Display for heap::ArrayHeap<i32> {
fn fmt(&self, f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
let x = std::vec::Vec::from_iter(self.items().iter().map(|x| x.to_string())).join(",");
std::fmt::Display::fmt(&x, f)
}
}
@ykhrustalev
ykhrustalev / postgres_queries_and_commands.sql
Created September 18, 2018 09:42 — 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%'
#
# pipenv:
#
# [packages]
# google-api-python-client = "*"
# google-auth = "*"
from google.oauth2 import service_account
from googleapiclient.discovery import build
@ykhrustalev
ykhrustalev / create-ssl-cert.sh
Created December 12, 2018 13:16 — forked from ArnaudValensi/create-ssl-cert.sh
Generate a self signed certificate without passphrase for private key
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 10000 -nodes
https://medium.com/@zitko/structuring-a-vue-project-authentication-87032e5bfe16
https://medium.com/@jcbaey/authentication-in-spa-reactjs-and-vuejs-the-right-way-e4a9ac5cd9a3
# modules/installer/cd-dvd/installation-cd-wifi.nix
{ config, ... }:
{
imports = [ ./installation-cd-graphical-gnome.nix ];
boot.kernelModules = [ "88x2bu" ];
boot.extraModulePackages = [
config.boot.kernelPackages.rtl88x2bu
];