Skip to content

Instantly share code, notes, and snippets.

package redisbenchmark
import java.util.UUID
import java.util.concurrent.ThreadLocalRandom
import akka.actor.ActorSystem
import akka.stream.{MaterializerSettings, OverflowStrategy, FlowMaterializer}
import akka.stream.scaladsl.{TickSource, IterableSource, Source}
import akka.util.ByteString
import redis.RedisClient
@stephenyeargin
stephenyeargin / referer-spam.md
Last active August 31, 2018 13:41
NGINX referral spam blocking

Following this guide + data from this page

File: /etc/nginx/global/referer-spam.conf

##
# Referrer exclusions
##
if ($http_referer ~ "(buttons-for-website\.com|darodar\.com|econom\.co|ilovevitaly\.co|kambasoft\.com|lumb\.co|7makemoneyonline\.com|ranksonic\.info|savetubevideo\.info|see-your-website-here\.com|semalt\.com|priceg\.com|srecorder\.com|descargar-musica-gratis\.net|54\.186\.60\.77|lomb\.co)") {
  set $prohibited "1";
@karpathy
karpathy / min-char-rnn.py
Last active November 12, 2025 07:00
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
<?
/////////////////////
// slack2html
// by @levelsio
/////////////////////
//
/////////////////////
// WHAT DOES THIS DO?
/////////////////////
//
@HybridEidolon
HybridEidolon / README.md
Created November 24, 2015 06:51
PSOBB Wine Mipmaps Patch

PSOBB Wine mipmap patch

For Phantasy Star Online: Blue Burst versions 1.25.10-1.25.13 and the Wine 1.7/1.8 series.

PSOBB tries to write all mipmaps at once on a single LockRect on mip level 0. This is undocumented behavior in Direct3D and PSOBB will clobber the implementation structs if this is not accounted for.

These patches, based on the PlayOnLinux League of Legends patch, do two

@Chandler
Chandler / slack_history.py
Last active March 27, 2025 01:16
Download Slack Channel/PrivateChannel/DirectMessage History
print("UPDATE AUG 2023: this script is beyond old and broken")
print("You may find interesting and more up to date resources in the comments of the gist")
exit()
from slacker import Slacker
import json
import argparse
import os
# This script finds all channels, private channels and direct messages
@TimShi
TimShi / Using s3video Jekyll Plugin.md
Last active March 4, 2022 21:02
Using s3video Jekyll Plugin

Embed Responsive S3_Video On Jekyll Site

  1. Use S3_Video to publish your video on AWS S3.
  2. Add bootstrap css to your Jekyll site.
  3. Place the plugin for S3Video in your Jekyll site's _plugins directory
  4. Now you can use the following markdown in your Jekyll pages to embed the video. Replace your-s3-video-id-here with your own stream ID.
{% s3video your-s3-video-id-here %}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RabbitMQ.Client.Events;
using Verify.Platform.Infrastructure.RabbitMQ.Producers;
namespace Verify.Platform.Infrastructure.RabbitMQ
{
public interface IRabbitUtilityService
@valyala
valyala / README.md
Last active November 4, 2025 00:19
Optimizing postgresql table for more than 100K inserts per second

Optimizing postgresql table for more than 100K inserts per second

  • Create UNLOGGED table. This reduces the amount of data written to persistent storage by up to 2x.
  • Set WITH (autovacuum_enabled=false) on the table. This saves CPU time and IO bandwidth on useless vacuuming of the table (since we never DELETE or UPDATE the table).
  • Insert rows with COPY FROM STDIN. This is the fastest possible approach to insert rows into table.
  • Minimize the number of indexes in the table, since they slow down inserts. Usually an index on time timestamp with time zone is enough.
  • Add synchronous_commit = off to postgresql.conf.
  • Use table inheritance for fast removal of old data:
@arxdsilva
arxdsilva / working_directory.go
Last active January 6, 2025 19:29
How to get the current working directory in golang
package main
// More info on Getwd()
// https://golang.org/src/os/getwd.go
//
import(
"os"
"fmt"
"log"
)