Skip to content

Instantly share code, notes, and snippets.

@theorm
theorm / KeyUtils.java
Last active June 8, 2020 08:12
Validate web push JWT tokens with VAPID
import com.google.common.io.BaseEncoding;
import org.bouncycastle.jce.ECNamedCurveTable;
import org.bouncycastle.jce.interfaces.ECPrivateKey;
import org.bouncycastle.jce.interfaces.ECPublicKey;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.bouncycastle.jce.spec.ECNamedCurveParameterSpec;
import org.bouncycastle.jce.spec.ECParameterSpec;
import org.bouncycastle.jce.spec.ECPrivateKeySpec;
import org.bouncycastle.jce.spec.ECPublicKeySpec;
import org.bouncycastle.math.ec.ECPoint;
import FirebaseFirestore
private struct Property {
let label: String
let value: Any
}
struct FirestoreModelData {
let snapshot: DocumentSnapshot
@codediodeio
codediodeio / database.rules.json
Last active June 22, 2024 07:03
Common Database Rules for Firebase
// No Security
{
"rules": {
".read": true,
".write": true
}
}
@DevWurm
DevWurm / entry.js
Last active March 4, 2019 15:21
angular-cli Electron configuration
const {app, BrowserWindow} = require('electron')
const path = require('path')
const url = require('url')
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let win
function createWindow () {
// Create the browser window.
@moveitonover
moveitonover / ios-currency-locale-table.json
Created October 4, 2016 06:43
iOS map of currency symbols with associated locales.
{
"TZS": [
"rwk_TZ",
"jmc_TZ",
"lag_TZ",
"sw_TZ",
"ksb_TZ",
"bez_TZ",
"asa_TZ",
"sbp_TZ",
@insidegui
insidegui / WebCacheCleaner.swift
Created September 14, 2016 23:12
Clear WKWebView's cookies and website data storage, very useful during development.
import Foundation
import WebKit
final class WebCacheCleaner {
class func clean() {
HTTPCookieStorage.shared.removeCookies(since: Date.distantPast)
print("[WebCacheCleaner] All cookies deleted")
WKWebsiteDataStore.default().fetchDataRecords(ofTypes: WKWebsiteDataStore.allWebsiteDataTypes()) { records in
@riywo
riywo / reference.md
Last active May 12, 2021 05:37
gdbとかassemblyのアンチョコ

2進数

  • 0xXX
    • 1 byte = 16進数2桁 = 8 bit
  • 0xXXXXXXXX
    • 4 byte = 16進数8桁 = 32 bit
    • int
  • 0xYYYYYYYYXXXXXXXX
    • 8 byte = 16進数16桁 = 64 bit
    • long int
@HarishChaudhari
HarishChaudhari / country-code-to-currency-code-mapping.csv
Last active June 28, 2024 13:56
Country, Country Code, Currency code mapping in CSV format Taken from https://gist.github.com/304261 Contains 249 countries.
Country CountryCode Currency Code
New Zealand NZ New Zealand Dollars NZD
Cook Islands CK New Zealand Dollars NZD
Niue NU New Zealand Dollars NZD
Pitcairn PN New Zealand Dollars NZD
Tokelau TK New Zealand Dollars NZD
Australian AU Australian Dollars AUD
Christmas Island CX Australian Dollars AUD
Cocos (Keeling) Islands CC Australian Dollars AUD
Heard and Mc Donald Islands HM Australian Dollars AUD