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
jump() { | |
if (( # == 0 )) | |
then | |
echo "Usage: $0 hostname [port]" | |
return 1 | |
fi | |
CMD="-J USERNAME@HOSTNAME:PORT $1" | |
# add remote ssh port if default ssh port isn't used | |
if [[ -z "$2" ]] | |
then |
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 std::io; | |
use std::process::exit; | |
#[derive(Debug)] | |
enum IpClasses { | |
A, | |
B, | |
C, | |
D, | |
E, |
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 rand::Rng; | |
use std::io; | |
enum Players { | |
Player1, | |
Player2, | |
} | |
struct Game { | |
player1: u32, |
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 rand::Rng; | |
use std::io; | |
enum Dice { | |
D4, | |
D6, | |
D8, | |
D10, | |
D12, | |
D20, |
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
// generate the nth fibonacci number | |
// Time Complexity: Exponential, as every function calls two other functions | |
use std::io; | |
fn fib(n: u32) -> u128 { | |
return if n == 0 { | |
0 | |
} else if n == 1 { | |
1 |
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
print(input("Guess a number(1-100) and Press enter to continue: ")) | |
low = 0 | |
high = 100 | |
count = 0 | |
while True: | |
count += 1 | |
guess = (low + high) // 2 | |
print("Is it", guess, "?") | |
answer = input("Enter 'h' if it's too high, 'l' if it's too low, or 'c' if it's correct: ") |
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
from urllib.request import Request, urlopen | |
from urllib.error import URLError, HTTPError | |
from html.parser import HTMLParser | |
from urllib.parse import urlparse | |
import gzip | |
def get_domain(url): | |
return bool(urlparse(url).netloc) |
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/sh -e | |
MIRROR="http://dl-cdn.alpinelinux.org/alpine" | |
VERSION="latest-stable" | |
[ "$(id -u)" -ne "0" ] && echo "You need to be root" >&2 && exit 1 | |
[ -z "$1" ] && echo "Usage: $0 destination" >&2 && exit 0 | |
dest="$1" | |
apkdir="$(mktemp -d)" |
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
#SURICATA STREAM ESTABLISHED packet out of window | |
suppress gen_id 1, sig_id 2210020 | |
#SURICATA STREAM reassembly overlap with different data | |
suppress gen_id 1, sig_id 2210050 | |
#SURICATA STREAM excessive retransmissions | |
suppress gen_id 1, sig_id 2210054 | |
#SURICATA zero length padN option |
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
#!/usr/bin/perl | |
# "pflog" enhancement for parsing maillog of postfix 2.3 or higher version. | |
# "pflog" see: http://www.tmtm.org/ruby/pflog/pflog-0.3 | |
use strict; | |
use warnings; | |
use Time::Local; | |
use Getopt::Long; | |
#use Data::Dumper; |
NewerOlder