Skip to content

Instantly share code, notes, and snippets.

View madduci's full-sized avatar

Michele Adduci madduci

View GitHub Profile
@andyferra
andyferra / github.css
Created April 30, 2012 02:11
Github Markdown CSS - for Markdown Editor Preview
body {
font-family: Helvetica, arial, sans-serif;
font-size: 14px;
line-height: 1.6;
padding-top: 10px;
padding-bottom: 10px;
background-color: white;
padding: 30px; }
body > *:first-child {
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active April 30, 2024 04:42
A badass list of frontend development resources I collected over time.
@chanks
chanks / gist:7585810
Last active February 29, 2024 03:50
Turning PostgreSQL into a queue serving 10,000 jobs per second

Turning PostgreSQL into a queue serving 10,000 jobs per second

RDBMS-based job queues have been criticized recently for being unable to handle heavy loads. And they deserve it, to some extent, because the queries used to safely lock a job have been pretty hairy. SELECT FOR UPDATE followed by an UPDATE works fine at first, but then you add more workers, and each is trying to SELECT FOR UPDATE the same row (and maybe throwing NOWAIT in there, then catching the errors and retrying), and things slow down.

On top of that, they have to actually update the row to mark it as locked, so the rest of your workers are sitting there waiting while one of them propagates its lock to disk (and the disks of however many servers you're replicating to). QueueClassic got some mileage out of the novel idea of randomly picking a row near the front of the queue to lock, but I can't still seem to get more than an an extra few hundred jobs per second out of it under heavy load.

So, many developers have started going straight t

@magicznyleszek
magicznyleszek / jekyll-and-liquid.md
Last active January 12, 2024 03:46
Jekyll & Liquid Cheatsheet

Jekyll & Liquid Cheatsheet

A list of the most common functionalities in Jekyll (Liquid). You can use Jekyll with GitHub Pages, just make sure you are using the proper version.

Running

Running a local server for testing purposes:

@staltz
staltz / introrx.md
Last active April 29, 2024 09:25
The introduction to Reactive Programming you've been missing
@pdp7
pdp7 / torrc
Created September 6, 2014 06:47
DigitalOcean non-exit relay /etc/tor/torrc
ORPort 443
Exitpolicy reject *:*
Nickname EFFisMyHero
ContactInfo <pdp7pdp7 AT gmail dot com> GPG: 0x84D44A9317F1138E
Log notice file /var/log/tor/notices.log
RelayBandwidthRate 1024 KB
RelayBandwidthBurst 1024 KB
MaxAdvertisedBandwidth 1024 KB
DisableDebuggerAttachment 0
@pdp7
pdp7 / install-tor.txt
Last active February 1, 2019 21:39
install tor non-exit relay on digital ocean
# My steps for creating a DigitalOcean server to run non-exit Tor node for just $5/mo
# Screen shots of my setup process: https://plus.google.com/photos/+DrewFustini/albums/6057260188204970945
# Create Digital Ocean account: https://www.digitalocean.com/
# Create Droplet on Digital Ocean: select $5/mo, and select Debian 7.0 64-bit
# This instructions are based on Tor Project: https://www.torproject.org/docs/tor-relay-debian.html.en
afustini@lappy486:~$ ssh root@107.170.203.104
root@107.170.203.104's password:
You are required to change your password immediately (root enforced)
Linux Tor300SoF 3.2.0-4-amd64 #1 SMP Debian 3.2.54-2 x86_64
@bjornblissing
bjornblissing / CMakeManifest.txt
Last active February 22, 2022 08:27
CMake script to add manifest to exe-file
# Amend manifest to tell Windows that the application is DPI aware (needed for Windows 8.1 and up)
IF (MSVC)
IF (CMAKE_MAJOR_VERSION LESS 3)
MESSAGE(WARNING "CMake version 3.0 or newer is required use build variable TARGET_FILE")
ELSE()
ADD_CUSTOM_COMMAND(
TARGET ${TARGET_TARGETNAME}
POST_BUILD
COMMAND "mt.exe" -manifest \"${CMAKE_CURRENT_SOURCE_DIR}\\dpiawarescaleing.manifest\" -inputresource:\"$<TARGET_FILE:${TARGET_TARGETNAME}>\"\;\#1 -outputresource:\"$<TARGET_FILE:${TARGET_TARGETNAME}>\"\;\#1
COMMENT "Adding display aware manifest..."
@NikoWoot
NikoWoot / reduce-size.dockerimage
Created December 19, 2014 08:37
Reduce size of Docker image
=================================================
After software installation
=================================================
RUN apt-get clean
RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
=================================================
Docker on build process, include all files on directory build (include .git with old build)
Solution for reduce size of docker image (but for reuse is not good solution)
=================================================
@chgeuer
chgeuer / brainpoolp256r1.cs
Last active April 22, 2022 11:17
Demonstrates how to use BouncyCastle with brainpoolp256r1 curve
namespace microsoft.chgeuer.crypto
{
// compile this baby against https://github.com/bcgit/bc-csharp
// or against NuGet <package id="BouncyCastle" version="1.7.0" targetFramework="net45" />
using Org.BouncyCastle.Asn1.X9;
using Org.BouncyCastle.Crypto.Generators;
using Org.BouncyCastle.Crypto.Parameters;
using Org.BouncyCastle.Security;