Skip to content

Instantly share code, notes, and snippets.

@learntheropes
learntheropes / update_time
Created February 29, 2024 17:25
update time
sudo ntpdate -b time.nist.gov
CREATE EXTENSION citext;
CREATE DOMAIN email AS citext
CHECK ( value ~ '^[a-zA-Z0-9.!#$%&''*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$' );
@learntheropes
learntheropes / change_password.sh
Created January 31, 2024 11:38
postgres change default user password
$ sudo -u postgres psql
psql (14.1 (Ubuntu 14.1-2.pgdg20.04+1))
Type "help" for help.
postgres=# \password postgres
Enter new password:
Enter it again:
@learntheropes
learntheropes / swap_zfs.sh
Last active July 5, 2023 03:37
Ubuntu set swap on a zfs drive
# https://askubuntu.com/questions/1198903/can-not-use-swap-file-on-zfs-files-with-holes/1198916#1198916
sudo zfs create -V 8G -b $(getconf PAGESIZE) -o logbias=throughput -o sync=always -o primarycache=metadata -o com.sun:auto-snapshot=false rpool/swap
sudo mkswap -f /dev/zvol/rpool/swap
sudo swapon /dev/zvol/rpool/swap
# Make the swap persistent after reboot
# https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-20-04#step-5-making-the-swap-file-permanent
<template>
<section class="section container">
<div class="card">
<div class="card-image">
<figure class="image is-4by3">
<img
src="https://bulma.io/images/placeholders/1280x960.png"
alt="Placeholder image"
/>
</figure>
sudo wget -q -O - https://raw.githubusercontent.com/LedgerHQ/udev-rules/master/add_udev_rules.sh | sudo bash
@learntheropes
learntheropes / isEmpty.js
Last active February 4, 2022 07:49
isEmpty and isFinite functions
function isEmpty(value){
return value === undefined ||
value === null ||
(typeof value === "object" && Object.keys(value).length === 0) ||
(typeof value === "string" && value.trim().length === 0)
}
module.exports = isEmpty;
@learntheropes
learntheropes / bittrex_private_and_public_api.gs
Last active March 3, 2021 08:57
Bittrex private and public API for Google Apps Script (Google Sheet)
// work in progress
// you need a bittrex API key and secret with read account option enabled
// I assume that all the keys are in the "keys" spreadsheet. The key is in cell B5 and the secret in cell C5
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("keys");
var key = sheet.getRange("B5").getValue()
var secret = sheet.getRange("C5").getValue();
var baseUrl = 'https://bittrex.com/api/v1.1/';
var nonce = Math.floor(new Date().getTime()/1000);
@learntheropes
learntheropes / main.scss
Last active September 17, 2019 14:57
sass in nuxtjs with bulma
npm install --save-dev @nuxtjs/style-resources sass-loader node-sass
@learntheropes
learntheropes / debian_ubuntu_command_line.md
Created August 16, 2019 21:20
Debian/Ubuntu command line staff

Get timezone

timedatectl status | grep "Time zone"