Skip to content

Instantly share code, notes, and snippets.

View EpicVoyage's full-sized avatar
🗺️

Chris EpicVoyage

🗺️
View GitHub Profile
@jmazzi
jmazzi / lastpass_to_keepassx.rb
Created June 13, 2010 19:57
Convert LastPass CSV to KeePassX XML
#!/usr/bin/ruby
#
# I recommend using Pocket to do the export. It works better than the browser extensions.
require 'rubygems'
require 'htmlentities'
require 'csv'
# CHANGE THIS
input_file = '/path/to/passwords.csv'
@jonleighton
jonleighton / base64ArrayBuffer.js
Last active May 21, 2024 04:57
Encode an ArrayBuffer as a base64 string
// Converts an ArrayBuffer directly to base64, without any intermediate 'convert to string then
// use window.btoa' step. According to my tests, this appears to be a faster approach:
// http://jsperf.com/encoding-xhr-image-data/5
/*
MIT LICENSE
Copyright 2011 Jon Leighton
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
@jed
jed / LICENSE.txt
Created May 20, 2011 13:27 — forked from 140bytes/LICENSE.txt
generate random UUIDs
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@domenic
domenic / promise-retryer.js
Last active September 16, 2023 02:43
Generalized promise retryer
"use strict";
// `f` is assumed to sporadically fail with `TemporaryNetworkError` instances.
// If one of those happens, we want to retry until it doesn't.
// If `f` fails with something else, then we should re-throw: we don't know how to handle that, and it's a
// sign something went wrong. Since `f` is a good promise-returning function, it only ever fulfills or rejects;
// it has no synchronous behavior (e.g. throwing).
function dontGiveUp(f) {
return f().then(
undefined, // pass through success
@bminer
bminer / changeTypeAttr.js
Created August 31, 2012 21:30
Cross-browser solution for changing the 'type' attribute of an `<input/>` tag.
/* x is the <input/> element
type is the type you want to change it to.
jQuery is required and assumed to be the "$" variable */
function changeType(x, type) {
if(x.prop('type') == type)
return x; //That was easy.
try {
return x.prop('type', type); //Stupid IE security will not allow this
} catch(e) {
//Try re-creating the element (yep... this sucks)
@theamnesic
theamnesic / Name Mangler advanced snippet
Created November 23, 2012 10:44 — forked from petermaurer/Name Mangler advanced snippet
Hardcore evil characters cleaner for Name Mangler (Regex alternative)
[findRegularExpression "[ÀàÁáÂâÃãÄäÅåĀāĂ㥹ǞǟǺǻ]", <name>, "a"]
[findRegularExpression "[ÆæǼǽ]", <name>, "ae"]
[findRegularExpression "[Ḃḃ]", <name>, "b"]
[findRegularExpression "[ĆćÇçČčĈĉĊċ]", <name>, "c"]
[findRegularExpression "[ḐḑĎďḊḋĐđÐðDZdzDŽdž]", <name>, "d"]
[findRegularExpression "[ÈèÉéĚěÊêËëĒēĔĕĘęĖėƷʒǮǯ]", <name>, "e"]
[findRegularExpression "[Ḟḟƒfffiflffifflſt]", <name>, "f"]
[findRegularExpression "[ǴǵĢģǦǧĜĝĞğĠġǤǥ]", <name>, "g"]
[findRegularExpression "[ĤĥĦħ]", <name>, "h"]
[findRegularExpression "[ÌìÍíÎîĨĩÏïĪīĬĭĮįİıIJij]", <name>, "i"]
@B-Con
B-Con / Credit Card Generator
Last active September 24, 2022 13:02
This JavaScript function generates random number strings that pass the Luhn checksum, the test that credit card numbers must conform to. It assumes there is an HTML radio input to indicate which company issued the card. This code is from my webpage here: http://bradconte.com/cc_generator.html.
// Copyright (c) 2015, Brad Conte (http://bradconte.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:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
@jawinn
jawinn / CreateWordpressUser.php
Last active December 16, 2023 21:58
Create WordPress Admin User from PHP
<?php
// ADD NEW ADMIN USER TO WORDPRESS
// ----------------------------------
// Put this file in your Wordpress root directory and run it from your browser.
// Delete it when you're done.
require_once('wp-blog-header.php');
require_once('wp-includes/registration.php');
// ----------------------------------------------------
@pkuczynski
pkuczynski / parse_yaml.sh
Last active June 15, 2024 20:30
Read YAML file from Bash script
#!/bin/sh
parse_yaml() {
local prefix=$2
local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034')
sed -ne "s|^\($s\)\($w\)$s:$s\"\(.*\)\"$s\$|\1$fs\2$fs\3|p" \
-e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 |
awk -F$fs '{
indent = length($1)/2;
vname[indent] = $2;
for (i in vname) {if (i > indent) {delete vname[i]}}
@patelm5
patelm5 / self-signed-trust-cert
Created February 5, 2014 10:31
Example of overridding self signed cert process in spring.
@Component
@Profile("untrusted")
public class SelfSignedTrustCertConfigurer {
private final static Logger logger = LoggerFactory.getLogger(SelfSignedTrustCertConfigurer.class.getName());
@PostConstruct
public void allowUntrustedCerts() {
HostnameVerifier hv = new HostnameVerifier() {
public boolean verify(String urlHostName, SSLSession session) {