Skip to content

Instantly share code, notes, and snippets.

@arun1587
arun1587 / tail_exec_cmd.go
Last active October 1, 2024 17:46
Tail file using exec Command
package main
import (
"bufio"
"fmt"
"os/exec"
)
func main() {
cmd := exec.Command("tail", "-f", "./test.log")
@Maffsie
Maffsie / sshfp.sh
Created January 17, 2015 15:27
generate SSHFP records
ssh-keyscan -t dsa,rsa,ecdsa hostname 2>/dev/null|perl -MMIME::Base64 -MDigest::SHA=sha1_hex,sha256_hex -lane 'sub k2fp {my $k=shift;$k=decode_base64($k);return (sha1_hex($k),sha256_hex($k));};my ($h,$t,$f)=@F;$t=1 if $t eq "ssh-dss";$t=2 if $t eq "ssh-rsa";$t=3 if $t eq "ecdsa-sha2-nistp256";my ($s1,$s256)=k2fp $f;print "$h. 86400 IN SSHFP $t 1 $s1";print "$h. 86400 IN SSHFP $t 2 $s256";'
@jirutka
jirutka / README.md
Last active February 15, 2016 21:01
Some experimental filters for OpenSMTPD.

Warning: Filter API is not stable yet.

Filters are not triggered when sending e-mail directly using the sendmail command.

@ismasan
ismasan / sse.go
Last active February 27, 2025 00:15
Example SSE server in Golang
// Copyright (c) 2017 Ismael Celis
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all
@kyledrake
kyledrake / ferengi-plan.txt
Last active November 14, 2025 04:39
How to throttle the FCC to dial up modem speeds on your website using Nginx
# The blog post that started it all: https://neocities.org/blog/the-fcc-is-now-rate-limited
#
# Current known FCC address ranges:
# https://news.ycombinator.com/item?id=7716915
#
# Confirm/locate FCC IP ranges with this: http://whois.arin.net/rest/net/NET-165-135-0-0-1/pft
#
# In your nginx.conf:
location / {
@jberkus
jberkus / gist:6b1bcaf7724dfc2a54f3
Last active March 7, 2026 17:59
Finding Unused Indexes
WITH table_scans as (
SELECT relid,
tables.idx_scan + tables.seq_scan as all_scans,
( tables.n_tup_ins + tables.n_tup_upd + tables.n_tup_del ) as writes,
pg_relation_size(relid) as table_size
FROM pg_stat_user_tables as tables
),
all_writes as (
SELECT sum(writes) as total_writes
FROM table_scans
@zacstewart
zacstewart / classifier.py
Last active September 19, 2024 23:56
Document Classification with scikit-learn
import os
import numpy
from pandas import DataFrame
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.naive_bayes import MultinomialNB
from sklearn.pipeline import Pipeline
from sklearn.cross_validation import KFold
from sklearn.metrics import confusion_matrix, f1_score
NEWLINE = '\n'
@kgaughan
kgaughan / threadpoolss.py
Created June 10, 2013 16:13
All the thread pool mixins for SocketServer are, well, not that good, so I knocked together my own. This one can cleanly shut down the pool
"""
Thread pool extensions to SocketServer.
"""
import Queue
import SocketServer
import sys
import threading
@azumakuniyuki
azumakuniyuki / smtpd.conf
Last active March 1, 2016 08:04
/usr/local/opensmtpd/etc/smtpd.conf for OpenSMTPD 5.3
# $OpenBSD: smtpd.conf,v 1.5 2012/10/11 21:16:28 gilles Exp $
# This is the smtpd server system-wide configuration file.
# See smtpd.conf(5) for more information.
myname = "mta.example.jp"
# To accept external mail, replace with: listen on all
# listen on interface [port port] [tls | smtps] [certificate name] [enable auth]
listen on 127.0.0.1 hostname "localhost"