Skip to content

Instantly share code, notes, and snippets.

@karanlyons
karanlyons / log4shell_regexes.py
Last active March 7, 2022 03:49
log4shell Regexes
import re
from urllib.parse import unquote
FLAGS = re.IGNORECASE | re.DOTALL
ESC_DOLLAR = r'(?:\$|[\\%]u0024||\\x24|\\0?44|%24)'
ESC_LCURLY = r'(?:\{|[\\%]u007B|\\x7B|\\173|%7B)'
ESC_RCURLY = r'(?:\}|[\\%]u007D|\\x7D|\\175|%7D)'
_U_PERCENT_ESCAPE_RE = re.compile(r'%(u[0-9a-f]{4})', flags=FLAGS)
_PERCENT_ESCAPE_RE = re.compile(r'%[0-9a-f]{2}', flags=FLAGS)
@slightfoot
slightfoot / main.dart
Last active June 1, 2024 11:10
Firebase Login/Logout Example - by Simon Lightfoot
/*
This example uses the following packages:
firebase_auth: 0.14.0+5
google_sign_in: 4.0.7
provider: 3.1.0+1
Make sure you have setup your project with Firebase by following these instructions:
1. Follow Option 1 instructions here up to Step 3
@ajinasokan
ajinasokan / flutter_desktop_macos.md
Last active November 22, 2019 14:38
Run Flutter apps in MacOS with IDE support and hot reloading

This setup is only for MacOS. I don't have a windows/linux machine to test.

Clone FDE repo

cd ~
git clone https://github.com/google/flutter-desktop-embedding

Switch to flutter master

@Diederikjh
Diederikjh / Cryptography.java
Last active May 24, 2024 04:08
Single class that handles encryption and decryption with keys using the Android `Keystore` API. Mostly inspired by this [blog post](https://medium.com/@ericfu/securely-storing-secrets-in-an-android-application-501f030ae5a3). This was tested with API 18 and 25 level emulator (and a level 23 device).
package com.example.yourapp;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Build;
import android.security.KeyPairGeneratorSpec;
import android.security.keystore.KeyGenParameterSpec;
import android.security.keystore.KeyProperties;
import android.support.annotation.RequiresApi;
@strawbryjam
strawbryjam / Gimp-gimp_spine.py
Last active February 14, 2021 19:03 — forked from NathanSweet/Gimp-gimp_spine.py
Gimp script to export to Esoteric Software's Spine: http://esotericsoftware.com/
#!/usr/bin/env python
'''
Get the latest gimp_spine.py script:
https://github.com/clofresh/gimp-spine
Copyright (c) 2014, Carlo Cabanilla <carlo.cabanilla@gmail.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@emilniklas
emilniklas / tether_protocol_1.0.md
Last active December 7, 2015 14:44
Tether Protocol v1.0

The Tether Messaging Protocol

Version 1.0

This Gist is the draft document for the Tether Messaging Protocol implemented in the Tether package for Dart.

Introduction

The Web is by definition a very connected platform. A device connected to the internet virtually has access to every other device on the web. There are multiple protocols that describe communications between these devices. For web pages, the dominating protocol is HTTP.

HTTP at the highest level is a standard for mapping resources and actions applied to those resources to a series of methods (GET, POST, PUT, PATCH, DELETE, OPTIONS and more) and URIs.

@paulirish
paulirish / how-to-view-source-of-chrome-extension.md
Last active July 22, 2024 13:58
How to view-source of a Chrome extension

Option 1: Command-line download extension as zip and extract

extension_id=jifpbeccnghkjeaalbbjmodiffmgedin   # change this ID
curl -L -o "$extension_id.zip" "https://clients2.google.com/service/update2/crx?response=redirect&os=mac&arch=x86-64&nacl_arch=x86-64&prod=chromecrx&prodchannel=stable&prodversion=44.0.2403.130&x=id%3D$extension_id%26uc" 
unzip -d "$extension_id-source" "$extension_id.zip"

Thx to crxviewer for the magic download URL.

@cedricziel
cedricziel / app.env.PLAY_OPTS
Last active November 17, 2016 23:14
Deploy a Play! Framework Application behind nginx -> haproxy -> netty (Play2 core) for transient upgrading. This setup fully supports Websockets in almost any variation. - But most importantly uses 2 instances minimum to allow seamless upgrade. Prepare the instances with "cd app/instances/$instance && ~/app/play/play clean compile stage"
fooapp@srv:~$ cat app/env/PLAY_OPTS
export DATABASE_URL="jdbc:postgresql://127.0.0.1/foobar"
# We could wire a different configuration file here
# or set up a different database on the fly
export PLAY_OPTS="-DapplyEvolutions.default=true -DapplyDownEvolutions.default=true -Ddb.default.url="$DATABASE_URL" -Ddb.default.user=fooapp -Ddb.default.password=fooapppw -Ddb.default.driver=org.postgresql.Driver"
@sma
sma / README.md
Last active June 18, 2024 20:08
This is an ad-hoc Java-to-Dart translator written in three days. This is version 2 which some bug fixes.

Java to Dart

This is an ad-hoc Java-to-Dart translator originally written on two (admittedly long) evenings.

See http://sma.github.io/stuff/java2dartweb/java2dartweb.html for a demo.

Note: It doesn't support the complete Java grammar specification and cannot translate everything. It only translates syntax and does not attempt to translate Java library classes and methods to Dart equivalents (with the exception of String.charAt and StringBuffer.append). You will have to make changes to the resulting Dart code. It does not support anonymous inner classes.

However, I was able to successfully convert a 7000+ line command line application with only minimal fixes in 30 minutes.

ClientGetter playClientGetter = new ClientGetter() {
private int playPort;
private String playHost;
{
String portString = System.getenv("PLAY_PORT");
if (portString == null)
portString = "9000";
playPort = Integer.parseInt(portString);
playHost = System.getenv("PLAY_HOST");