Skip to content

Instantly share code, notes, and snippets.

View nstickney's full-sized avatar

Stick nstickney

View GitHub Profile
use crate::common::Solution;
use std::collections::BTreeMap;
type PassportInformation<'a> = BTreeMap<&'a str,&'a str>;
pub fn solve(lines: &[String]) -> Solution {
let s = lines.join("\n");
let passports: Vec<PassportInformation> = s.split("\n\n")
.map(|pwd_fields| pwd_fields
.split_whitespace()
@deoxys314
deoxys314 / 4d.vim
Last active October 14, 2020 15:16
Four-Dimensional Editing in Vim
let s:second = 1
let s:minute = 60 * s:second
let s:hour = 60 * s:minute
let s:day = 24 * s:hour
let s:week = 7 * s:day
let s:month = 30 * s:day
let s:year = 365 * s:day
function! s:get_undo_time(undo_dict) abort
let l:idx = a:undo_dict.seq_cur
#!/bin/bash
NUM_SERVERS=$1
if [ -z "$NUM_SERVERS" ]; then
NUM_SERVERS=20
fi
if [ ! -f "/etc/arch-release" ]; then
echo "This script should only run on arch linux"
exit 1
fi
@IanColdwater
IanColdwater / twittermute.txt
Last active November 17, 2024 02:37
Here are some terms to mute on Twitter to clean your timeline up a bit.
Mute these words in your settings here: https://twitter.com/settings/muted_keywords
ActivityTweet
generic_activity_highlights
generic_activity_momentsbreaking
RankedOrganicTweet
suggest_activity
suggest_activity_feed
suggest_activity_highlights
suggest_activity_tweet
@Biont
Biont / sway-launcher-desktop.sh
Last active November 17, 2024 09:10
sway-launcher-desktop
#!/usr/bin/env bash
# terminal application launcher for sway, using fzf
# Based on: https://gitlab.com/FlyingWombat/my-scripts/blob/master/sway-launcher
shopt -s nullglob
if [[ "$1" == 'describe' ]]; then
shift
if [[ $2 == 'command' ]]; then
title=$1
readarray arr < <(whatis -l "$1" 2>/dev/null)
@lewisridden
lewisridden / Iris-Keyboard.kbd.json
Last active October 3, 2024 09:26
Iris Keyboard
[
{
"name": "Iris Keyboard",
"author": "Lewis Ridden"
},
[
{
"x": 3,
"c": "#c4c8c5",
"a": 5
@Dman46
Dman46 / jail.local
Last active July 15, 2020 20:20
Fail2ban - send Slack notifications
...
action_with_slack_notification = %(banaction)s[name=%(__name__)s, bantime="%(bantime)s", port="%(port)s", protocol="%(protocol)s", chain="%(chain)s"]
slack[name=%(__name__)s]
action = %(action_with_slack_notification)s
...
@Nihisil
Nihisil / jail.local
Last active September 5, 2023 06:20
Send notifications to the Slack from fail2ban
...
action_with_slack_notification = %(banaction)s[name=%(__name__)s, port="%(port)$
slack[name=%(__name__)s]
action = %(action_with_slack_notification)s
...
@magnetikonline
magnetikonline / README.md
Last active June 18, 2024 05:43
BIND - delegate a sub domain for a zone.

BIND - delegate a sub domain for a zone

The scenario:

  • DNS zone myzone.com defined in BIND.
  • Authoritative name server at 123.16.123.1.
  • Subzone sub.myzone.com with an authoritative name server at 123.16.123.10.
  • Wishing to forward sub-zone to authoritative name server.

Config

@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active November 17, 2024 01:28
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname