Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View kuzmik's full-sized avatar
🐱

Nick Kuzmik kuzmik

🐱
View GitHub Profile

Keybase proof

I hereby claim:

  • I am kuzmik on github.
  • I am kuzmik (https://keybase.io/kuzmik) on keybase.
  • I have a public key whose fingerprint is EAF1 3774 11D4 37C2 D704 1AC5 69FF 6150 957C E85C

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am kuzmik on github.
  • I am kuzmik (https://keybase.io/kuzmik) on keybase.
  • I have a public key whose fingerprint is E6BE BFCB 797B B5D1 79FE 7966 7E9C C486 05CB 1E24

To claim this, I am signing this object:

#!/bin/bash
# The fuckfaces ipset will hold any ip that appears to be portscanning or brute forcing ssh connections.
ipset -q create fuckfaces hash:ip counters
zgrep "Bad protocol" /var/log/auth.* | grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' | sort | uniq | xargs -I{} ipset -q add fuckfaces {}
zgrep "Did not receive identification string from" /var/log/auth.* | grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' | sort | uniq | xargs -I{} ipset -q add fuckfaces {}
zgrep "Invalid user" /var/log/auth.* | grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' | sort | uniq | xargs -I{} ipset -q add fuckfaces {}
# buuuut remove anyone from the list who has a pk that works, just in case.
zgrep "Accepted publickey" /var/log/auth.log* | grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' | sort | uniq | xargs -I{} ipset -q del fuckfaces {}
@kuzmik
kuzmik / commission junction.rb
Created August 8, 2017 03:28
client for CJ
def self.product_search(str)
key = 'YOUR_KEY'
pid = 'YOUR_PID'
cj = CommissionJunction.new(key, pid)
items = cj.product_search(
'keywords' => str.split(' ').reduce('') { |keywords, s| keywords += " +#{s}" },
'serviceable-area' => 'us',
'advertiser-ids' => '2045991, 3379721, 1461363, 3449087, 3055640',
'currency' => 'usd',
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Script.Serialization;
using Cotdom.Cobalt;
@kuzmik
kuzmik / catalog.sql
Last active August 17, 2017 02:40
how NOT to design a database, courtesy your friends at Nexagen USA dot com
CREATE TABLE [dbo].[Catalog](
[SKU] [nvarchar](15) NOT NULL,
[brief_en_US] [varchar](100) NULL,
[highdescription_en_US] [ntext] NULL,
[lowdescription_en_US] [ntext] NULL,
[shipdescription_en_US] [varchar](100) NULL,
[brief_es_PR] [varchar](100) NULL,
[highdescription_es_PR] [ntext] NULL,
[lowdescription_es_PR] [ntext] NULL,
[BV] [int] NULL,
@kuzmik
kuzmik / 850.cs
Created August 8, 2017 03:38
XML EDI parser
public void ParseFile()
{
if (!this.hasdeliveries)
return;
XDocument data = XDocument.Load(this.file.FullName);
var q = from x in data.Elements("TRANSFER").Elements("MESSAGE")
select x.Value;
@kuzmik
kuzmik / fuck systemd.sh
Last active January 10, 2018 17:49
srsly fuck systemd
apt install -y sysvinit-core locate
cp /usr/share/sysvinit/inittab /etc/inittab
echo -e 'Package: *systemd*\nPin: release *\nPin-Priority: -1\n' > /etc/apt/preferences.d/eat-shit-systemd
echo -e 'Package: libsystemd0\nPin: version *\nPin-Priority: 500\n' >> /etc/apt/preferences.d/eat-shit-systemd
reboot
apt remove -y --purge --auto-remove systemd dbus libdbus-1-3
apt update
@kuzmik
kuzmik / git-pre-push-hook-install.sh
Last active March 29, 2018 18:03 — forked from johnhamelink/git-pre-push-hook-install.sh
Run `rake` before push. Because reasons.
cd /path/to/your/repo
curl https://gist.githubusercontent.com/kuzmik/c08864648e4721f96a2a3050384ee030/raw/dad37f43037e44af991c81e65c9a739669d0556a/pre-push.sh > .git/hooks/pre-push
chmod u+x .git/hooks/pre-push
@kuzmik
kuzmik / logins.sh
Last active October 29, 2020 15:30
Remote work login script
#!/usr/local/bin/bash
### This assumes you are on the VPN already.
# Log in to the 1pw vault
eval $(op signin work)
if [[ -z $OP_SESSION_work ]]; then
echo "!! Error logging into 1password"
exit 1
else