Skip to content

Instantly share code, notes, and snippets.

View demiurg's full-sized avatar

Pavel demiurg

View GitHub Profile
function handleMousemove(vmap){
var self = this;
self.event = null;
self.highlight = function(e){
console.log(self.event);
if (self.event != e){
return;
}
truncate -s +100G /data/containers/expand.img
sudo zpool set autoexpand=on lxd
# sudo zpool online -e lxd /data/containers/expand.img
sudo zpool add lxd /data/containers/expand.img
sudo zpool set autoexpand=off lxd
@demiurg
demiurg / filtering.js
Last active July 6, 2018 20:45
JavaScript FUN
filterSites = (sites, terms) => {
var REDUCERS = {
'AND': (acc, cur) => acc && cur,
'OR': (acc, cur) => acc || cur
};
var filtered_sites = Object.values(sites).filter((s) => {
if (s && typeof s == 'object'){
var props = s.properties;
var truths = terms.map((term, idx) => {
@demiurg
demiurg / authorizekoba.sh
Last active November 29, 2018 16:50
authorizekoba.sh
set -e
ssh-keygen -f ~/.ssh/id_rsa -t rsa -N ""
echo 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDC5yHa4u65Vv3UORt0p6PXKQbUCzTNX+d+qBzJvnTUrFGOatIZP4XQ7lfh7qu2DI+IO98FPZoy05ZPKGYwSR9/aOdHxA1w+gwOeXMc4M/M9naGbNXAD/DkLxMY7vwG6cDDCHaF7iUQ4hlrynZ9o/riefpijlczFqjAEJgtGU63YgQm4bQPHkx2P0nTd6TFSWku6CfyfqWR0xotWcw5p5kaUgoTldxv1mixIJ3FKzlgSZu6RpdPcapWIcsbPlg9+OxBFYbTq5CtOaR7V522pREINmasckMIYvuF0av7U6A0UBhmFVVMmfxra/xkd2Xe3Iwo+w0+laQLCC5goyFB6RlL [email protected]' > ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
.bashrc
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
export PATH=/usr/local/bin:/usr/local/sbin:$PATH
export PATH="${PATH}:/usr/local/texlive/2014basic/bin/x86_64-darwin"
#export PATH="$(brew --prefix coreutils)/libexec/gnubin:/usr/local/bin:$PATH"
Open RegEdit
Navigate to this Key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp
Change “SecurityLayer” to a zero
Reboot and done!
import numba as nb
from concurrent.futures import ThreadPoolExecutor
from multiprocessing import cpu_count
@nb.jit(nogil=True)
def slow_calculation(x):
out = 0
for i in range(x):
out += i**0.01
return out
alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
def numToLetter(number):
result = "";
charIndex = int(number % len(alphabet))
quotient = int(number / len(alphabet))
if (charIndex - 1 == -1):
charIndex = len(alphabet);
@demiurg
demiurg / aws_rds_copy.sh
Created July 29, 2022 15:53
Copy RDS PG database without roles
#!/bin/bash
set -e
set -u
PS3='Migrate database for an environment. Please enter your choice: '
options=("dev" "uat" "prod" "Quit")
select opt in "${options[@]}"
do

Carbon Mapper

Modified Creative Commons Attribution ShareAlike 4.0 International Public License

Effective Dates: November 9, 2021 – August 31, 2024

Carbon Mapper (the "Licensor") provides its data ("Data") to third parties for non-commercial purposes subject to this Modified Creative Commons Attribution ShareAlike 4.0 International Public License ("CC License"). Third party use of the Data shall at all times be subject to the CC License.

By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this modified Creative Commons Attribution ShareAlike 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions.