Skip to content

Instantly share code, notes, and snippets.

View solrevdev's full-sized avatar
💭
🤓

John Smith solrevdev

💭
🤓
View GitHub Profile
using System;
using System.Threading.Tasks;
namespace System.Collections.Concurrent
{
public static class ConcurrentDictionaryExtensions
{
/// <summary>
/// Provides an alternative to <see cref="ConcurrentDictionary{TKey, TValue}.GetOrAdd(TKey, Func{TKey, TValue})"/> that disposes values that implement <see cref="IDisposable"/>.
/// </summary>
sudo apt-get update
sudo apt-get install -y wget curl ca-certificates curl apt-transport-https lsb-release gnupg build-essential git docker.io docker-compose
wget -q https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
# Add Repos
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
@troyhunt
troyhunt / rick-roll-content-scraper.js
Created August 19, 2020 07:41
A Cloudflare worker to redirect image requests from dickhead content scraper's site to a Rick Roll
addEventListener('fetch', event => {
event.respondWith(fetchAndApply(event.request))
})
async function fetchAndApply(request) {
let response = await fetch(request)
let referer = request.headers.get('Referer')
let contentType = response.headers.get('Content-Type') || ''
if (referer && contentType.startsWith('image/')) {
@RafaelRuales
RafaelRuales / Virustotal Scanner
Last active July 2, 2022 11:34 — forked from hahnicity/Virustotal Scanner
Python code to scan a list of URLs programmatically with virustotal. Requires a virustotal API key to work
"""
virustotal_scan
~~~~~~~~~~~~~~~
Programmatically scan URLs with virustotal.
"""
import argparse
import json
import os
@solrevdev
solrevdev / setup.sh
Created July 6, 2020 20:50 — forked from chris-sev/setup.sh
Mac Setup
# how to run this thingy
# create a file on your mac called setup.sh
# run it from terminal with: sh setup.sh
#!/bin/bash
set -euo pipefail
# Display message 'Setting up your Mac...'
echo "Setting up your Mac..."
sudo -v
@jdavid82
jdavid82 / .vimrc
Last active December 2, 2024 09:40
vim settings for full stack C# development in Windows 10
"Allow project specific .vimrc execution
set exrc
"no backup files
set nobackup
"only in case you don't want a backup file while editing
set nowritebackup
"no swap files
@mtilson
mtilson / script.sh
Last active July 31, 2024 16:49
how to run Shell commands from GitHub with help of Curl and shortened Git.io URLs [github]
## How to run Shell commands from GitHub with help of Curl and shortened Git.io URLs [github]
# With help of GitHub web UI create public repository (repository name: `REPO`) under
# your GitHub user account (user name: `USER`). This results in Git repository URL
# of `https://github.com/USER/REPO.git`
# Initialize local Git repository and create, commit, and push to the `master` branch
# (or other one) a file (file name: `run`) with shell commands you'd like to run
git init
git remote add origin https://github.com/USER/REPO.git
@tigt
tigt / git-branch-to-favicon.js
Created March 18, 2020 21:10
Creates an SVG string that can be used as a favicon across different Git branches. Actually getting this into the browser is sadly project-specific.
const { execSync } = require('child_process')
const { createHash } = require('crypto')
const invertColor = require('invert-color')
const branchName = execSync('git rev-parse --abbrev-ref HEAD')
const hash = createHash('sha256')
hash.update(branchName)
const color = '#' + hash.digest().toString('hex').substring(0, 6)
const invertedColor = invertColor(color, true)
@mikegrima
mikegrima / edit_brave_dictionary.md
Last active December 12, 2024 19:40
Edit Brave Browser Dictionary

Fix Brave Browser Dictionary

If you have ever mistakenly added a word to the Brave browser dictionary, you need to manually edit the Custom Dictionary.txt file.

As of March 2020, the Brave UI lacks a feature to do this.

Where is the file?

This will depend on your OS. Google for where this is on your OS.

The file on macOS is at: ~/Library/Application\ Support/BraveSoftware/Brave-Browser/Default/Custom\ Dictionary.txt.

@ErikEJ
ErikEJ / IQueryableExtensions.cs
Last active May 15, 2025 07:58
Replacement for EF Core .Contains, that avoids SQL Server plan cache pollution
using System.Linq.Expressions;
namespace Microsoft.EntityFrameworkCore
{
public static class IQueryableExtensions
{
public static IQueryable<TQuery> In<TKey, TQuery>(
this IQueryable<TQuery> queryable,
IEnumerable<TKey> values,
Expression<Func<TQuery, TKey>> keySelector)