Skip to content

Instantly share code, notes, and snippets.

@Siss3l
Siss3l / 0623.md
Last active July 1, 2023 09:02
Intigriti's June 2023 XSS web challenge thanks to @0xGodson_

Intigriti June Challenge

  • Category: Web
  • Impact: Medium
  • Solves: ~50

Chall

Description

@keymastervn
keymastervn / bm__JSON.parse_HWIA_deep_symbolize_keys_symbolized_name.rb
Last active April 28, 2023 08:25
bm__JSON.parse_HWIA_deep_symbolize_keys_symbolized_name
# frozen_string_literal: true
require 'benchmark/ips'
require 'benchmark/memory'
require 'active_support/all'
TIMES = 50_000
HASH = {
"colour" => "red",
@berkorbay
berkorbay / github_desktop_ubuntu.md
Last active May 29, 2024 16:26
To install Github Desktop for Ubuntu

IMPORTANT

See the following links for further updates to Github Desktop for Ubuntu. These are official instructions. (also mentioned by fetwar on Nov 3, 2023)

For the sake of "maintaining the tradition" here is the updated version.

That time I had to compile Vim from source...

January 2, 2018

Recently, something broke in Homebrew's version of Vim. Several things seemed weird, but what first caught my eye was that misspelled words were no longer highlighted in Markdown files. This is a feature that I have previously configured and I use it often when writing blog posts and such.

Initially, I assumed I had a problem with my Vim settings. After much troubleshooting and no joy, I finally uninstalled Homebrew's version of Vim which caused my system to fall back to the default version of Vim that ships with macOS. Suddenly the highlighting worked fine.

After doing some further research, I decided I would try to compile and install Vim myself. After some googling and patching together a few different articles, this is what worked for me.

Scaling your API with rate limiters

The following are examples of the four types rate limiters discussed in the accompanying blog post. In the examples below I've used pseudocode-like Ruby, so if you're unfamiliar with Ruby you should be able to easily translate this approach to other languages. Complete examples in Ruby are also provided later in this gist.

In most cases you'll want all these examples to be classes, but I've used simple functions here to keep the code samples brief.

Request rate limiter

This uses a basic token bucket algorithm and relies on the fact that Redis scripts execute atomically. No other operations can run between fetching the count and writing the new count.

@wojteklu
wojteklu / clean_code.md
Last active May 29, 2024 11:51
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@bgromov
bgromov / git-reset-author.sh
Created June 23, 2016 17:50
Git: reset author for ALL commits
#!/bin/sh
# Credits: http://stackoverflow.com/a/750191
git filter-branch -f --env-filter "
GIT_AUTHOR_NAME='Newname'
GIT_AUTHOR_EMAIL='new@email'
GIT_COMMITTER_NAME='Newname'
GIT_COMMITTER_EMAIL='new@email'
" HEAD
@tiagoamaro
tiagoamaro / hash_with_indifferent_access_benchmark.rb
Last active April 28, 2023 08:25
ActiveSupport's HashWithIndifferentAccess access benchmark vs common Ruby Hash
#####################
# Ruby Version: 2.1.6
#####################
# gem 'activesupport', '=3.2.22'
# gem 'activesupport', '=4.2.5'
require 'active_support/all'
require 'benchmark/ips'