This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
! See keys with: | |
! xev | |
! Clear memory: | |
! setxkbmap -option | |
! | |
! Use this file: | |
! xmodmap ~/.Xmodmap | |
! | |
!setxkbmap -layout gb -option ctrl:nocaps |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- prompts: | |
-- From: select inet_server_addr() | |
select case | |
when inet_server_addr()='10.0.0.61' then '%[%033[1;35m%]' -- red | |
when inet_server_addr()='10.0.0.24' then '%[%033[1;31m%]' -- purp | |
else '[%037[1m%]' -- cyan | |
end as col \gset | |
\set PROMPT2 '[more] %R > ' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<install nginx, postgresql postgresql-contrib> | |
adduser andy | |
usermod -aG sudo username | |
<copy bash_profile> | |
<copy: /etc/nginx/sites-enabled/> | |
<copy: /etc/systemd/system/> | |
<copy: letsencrypt files, install certbot https://community.letsencrypt.org/t/move-to-another-server/77985/4 > | |
<update crontab> | |
<sudo vim /etc/postgresql/14/main/pg_hba.conf https://stackoverflow.com/questions/18664074/getting-error-peer-authentication-failed-for-user-postgres-when-trying-to-ge > | |
sudo usermod -a -G andy www-data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Script to tail logs of given kube service | |
if [ $# -eq 0 ] | |
then | |
printf "Give me a service to look for" | |
exit 1 | |
fi | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To be run when plugged into display: | |
# Reset to normal laptop: | |
# xrandr --output eDP-1 --scale .5x.5 | |
xrandr --auto | |
xrandr --output eDP-1-1 --mode 1920x1080 --pos 2560x400 --scale 1x1 | |
xrandr --output DVI-I-2-1 --scale 1x1 --mode 2560x1440 --left-of eDP-1-1 | |
# curve screen: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://rz0r.net/post/2019-05-27-flask-logging/ | |
import os | |
import logging | |
import socket | |
from flask import Flask | |
from logging.config import dictConfig | |
class ContextFilter(logging.Filter): | |
hostname = socket.gethostname() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use rayon::prelude::*; | |
use std::rc::Rc; | |
use std::sync::Arc; | |
use std::cell::RefCell; | |
use std::cell::RefCell; | |
#[macro_use] | |
extern crate rayon; | |
struct ResultOfCalc { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
########## Handle every case on dictionary gets and type casts. | |
# No: | |
winner_odds = schedule_json.get("sp", {}).get("main", []) | |
away_odds = float(winner_odds[0].get("odds", 0)) | |
# Count the ways the above can go wrong | |
# len(winner_odds) == 0 | |
# winner_odds[0] == {"odds": "a string"} | |
# winner_odds[0] == might not be a dictionary | |
# schedule_json.get("sp") might not contain a dictionary | |
# schedule_json.get("sp", {}).get("main") might not contain a list |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
import math | |
from os import system, name | |
ship_types = [ | |
"Cobra", "Krait", "Viper", "Anaconda", "Sidewinder", "Vulture", "Asp", | |
] | |
ship_grading = [ | |
"Rookie", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub fn how_to_loop_round_a_vec(tokens : &[reader::Token]) { | |
let ti = tokens[1..].iter(); | |
let mut new_list = vec![to_add]; | |
// If you do not specify an iter() in a loop then into_iter() is used which consumes the vec | |
for nxt_token in ti { | |
new_list.push( | |
match nxt_token { | |
&reader::Token::List(ref list) => apply_sym(None, None, &list, func_map), | |
&_ => nxt_token.clone() | |
} |
NewerOlder