Skip to content

Instantly share code, notes, and snippets.

@davidfowl
davidfowl / gist:3173128
Created July 24, 2012 22:36 — forked from jmangelo/gist:3173109
MethodInfo.Invoke is slow... open instance delegate to the rescue
using System;
using System.Linq;
using System.Diagnostics;
using System.Linq.Expressions;
using System.Reflection;
using System.Collections.Generic;
namespace ConsoleApplication3
{
class Program
@gerdriesselmann
gerdriesselmann / restart_on_change.sh
Created December 30, 2014 21:11
Restart service if binary has changed
#!/bin/bash
SERVICE="{service_name}"
FILE="{/path/to/service/binary}"
FINGERPRINT="/root/watchers/$SERVICE.md5"
fingerprint_expected=$(/usr/bin/md5sum "$FILE")
if [ ! -e "$FINGERPRINT" ]
then
echo "$fingerprint_expected" > "$FINGERPRINT"
@AlbertoMonteiro
AlbertoMonteiro / 01.md
Last active January 23, 2024 10:11
Migration from Moq to NSubstitute
@JohannesDeml
JohannesDeml / README.md
Last active May 17, 2024 23:09
Batch convert images with inkscape on windows

Batch convert svg|pdf|eps|emf|wmf|ai|ps|cdr to eps|pdf|png|jpg|tiff|svg|ps|emf|wmf

Screenshot Batch converter for Windows using Inkscape with the command line
InkscapeBatchConvert is an easy to use solution to quickly convert all files of a folder to another type without the need to open Inkscape. The program uses Windows Batch scripting and will only work on Windows.
Tested with Inkscape 1.0.x - 1.3.x ✅ (The last version that supports Inkscape 0.9.x can be found here)

Usage

  1. Download _InkscapeBatchConvert.bat
  2. Put it in the folder where you have files you wish to convert (will also scan on all subfolders for files of input type).
  3. Then double click the file to start it.
shader_type canvas_item;
//inputs
uniform float AMT = 0.7; //0 - 1 glitch amount
uniform float SPEED = 0.6; //0 - 1 speed
//2D (returns 0 - 1)
float random2d(vec2 n) {
return fract(sin(dot(n, vec2(12.9898, 4.1414))) * 43758.5453);
}
@samsch
samsch / stop-using-jwts.md
Last active July 15, 2024 09:26
Stop using JWTs

Stop using JWTs!

TLDR: JWTs should not be used for keeping your user logged in. They are not designed for this purpose, they are not secure, and there is a much better tool which is designed for it: regular cookie sessions.

If you've got a bit of time to watch a presentation on it, I highly recommend this talk: https://www.youtube.com/watch?v=pYeekwv3vC4 (Note that other topics are largely skimmed over, such as CSRF protection. You should learn about other topics from other sources. Also note that "valid" usecases for JWTs at the end of the video can also be easily handled by other, better, and more secure tools. Specifically, PASETO.)

A related topic: Don't use localStorage (or sessionStorage) for authentication credentials, including JWT tokens: https://www.rdegges.com/2018/please-stop-using-local-storage/

The reason to avoid JWTs comes down to a couple different points:

  • The JWT specification is specifically designed only for very short-live tokens (~5 minute or less). Sessions
@jackdomleo7
jackdomleo7 / Useful_global_CSS.css
Last active June 21, 2024 17:35
A set of useful global CSS defaults to add to your site alongside a reset stylesheet (with explanations)
/*! NOTE: These are just recommended default global styles, edit as required */
@import ('Import reset stylesheet here, (I recommend modern-normalize) or even better, import the reset stylesheet in the HTML as the first imported stylesheet');
::selection { /* Optional */
/* It can be really hard to read highlighted text with a text-shadow, it should be removed when selected */
text-shadow: none;
/* NOTE: Using this means the color and background-color are set to transparent for selected text... */
/* So you can customise your styles below */
using System;
using System.Collections.Generic;
public static class VonNeumannExtensions
{
public static IEnumerator<int> GetEnumerator(this int number)
{
for (var i = 0; i < number; i++)
{
yield return i;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Diagnostics;
using System.IO;
using System.IO.Compression;
using System.IO.Pipes;
using System.Linq;
using System.Management;
using System.Net;
@lenicyl
lenicyl / CompileAP.md
Last active December 15, 2023 15:50
How to build ArmorPaint