Skip to content

Instantly share code, notes, and snippets.

@lmas
lmas / unbound_blocklist.sh
Last active Apr 18, 2020
Script to generate a blocklist zone file for unbound DNS server
View unbound_blocklist.sh
#!/bin/bash
# Inspired by:
# https://old.reddit.com/r/PFSENSE/comments/9mipe0/unboundbased_dnsblacklisting/
# https://news.ycombinator.com/item?id=22854209
#
# With lotsa code stolen from:
# https://www.tumfatig.net/20190405/blocking-ads-using-unbound8-on-openbsd/
#
# Comment filter syntax from:
@lmas
lmas / decrapifier.ps1
Created Jan 25, 2020
Windows 10 Decrapifier
View decrapifier.ps1
# SOURCE AND AUTHOR:
# https://community.spiceworks.com/scripts/show/4378-windows-10-decrapifier-18xx-19xx
#
#Windows 10 Decrapifier 1803/1809
#By CSAND
#June 21 2019
#
#
#PURPOSE: Eliminate much of the bloat that comes with Windows 10. Change many privacy settings to be off by default. Remove built-in advertising, Cortana, OneDrive, Cortana stuff (all optional). Disable some data collection.
# Clean up the start menu for new user accounts. Remove a bunch of pre-installed apps, or all of them (including the store). Create a more professional looking W10 experience. Changes some settings no longer
@lmas
lmas / generate_token.go
Last active Nov 14, 2019
Generate random, hex encoded tokens
View generate_token.go
package main
import (
"crypto/rand"
"crypto/sha256"
"encoding/binary"
"encoding/hex"
"fmt"
"time"
)
@lmas
lmas / Dockerfile
Created Apr 2, 2019
Minimalist dockerfile for running standalone binaries
View Dockerfile
FROM alpine:3.9 AS builder
RUN apk add --no-cache ca-certificates && \
mkdir -p /build/etc/ssl/certs && \
cp /etc/ssl/certs/ca-certificates.crt /build/etc/ssl/certs/ && \
echo 'app:x:2000:2000::/:' > /build/etc/passwd && \
echo 'app:x:2000:' > /build/etc/group && \
mkdir /data
################################################################################
@lmas
lmas / crt.css
Created Mar 24, 2019
Add CRT scanlines, screen flicker and color separation effects
View crt.css
/*Stolen from http://aleclownes.com/2017/02/01/crt-display.html*/
/*This adds a "crt scanlines" effect to the screen*/
.crt-scanlines::before {
content: " ";
display: block;
position: absolute;
top: 0;
left: 0;
bottom: 0;
@lmas
lmas / http_utils.go
Created Nov 28, 2018
Some simple http utils (http handlers with errors, secure cookies)
View http_utils.go
import (
"net/http"
"time"
"github.com/gorilla/securecookie"
)
type WebError struct {
Code int
Err error
@lmas
lmas / api_client.go
Created Jan 1, 2018
Simple API client with json parsing, gzip compression, ratelimit and oauth tokens
View api_client.go
package main
import (
"compress/gzip"
"context"
"encoding/json"
"fmt"
"net/http"
"net/url"
"time"
@lmas
lmas / summarize.go
Created Sep 28, 2017
Summarizes text
View summarize.go
import (
"strings"
"github.com/JesusIslam/tldr"
)
func Summarize(text string) (string, float64, error) {
sum := tldr.New()
tmp, err := sum.Summarize(text, 6)
if err != nil {
@lmas
lmas / rng_imager.go
Created Sep 8, 2017
Simple attempt at visual analysis of RNG sources
View rng_imager.go
package main
// Inspiration: https://www.random.org/analysis/
import (
"image"
"image/color"
"image/png"
"math/big"
"os"
@lmas
lmas / closing_channels_sends_zero_vals.go
Created Jul 12, 2017
Reading values from a closed channel only returns zero values
View closing_channels_sends_zero_vals.go
package main
import (
"log"
)
func main() {
// Also works with other channel types, like: chan string, chan int etc.
// NOTE: The zero value for "bool" types is == false
ch := make(chan bool)
You can’t perform that action at this time.