Skip to content

Instantly share code, notes, and snippets.

View ebababi's full-sized avatar

Nikolaos Anastopoulos ebababi

View GitHub Profile
@brenttheisen
brenttheisen / factory_girl.rake
Created June 24, 2011 20:17
Rake task that loads factories using factory_girl in to the current environment's database. Intended to be a replacement for Rail's rake db:fixtures:load.
#
# To install copy this file in to <RAILS_APP>/lib/tasks/factory_girl.rake.
# To use run: rake db:factory_girl_load
#
namespace :db do
namespace :factory_girl do
desc 'Load Factory Girl factories into the current environment\'s database.'
task :load => :environment do
FactoryGirl.registry.each do |(name, factory)|
FactoryGirl.build name
@ebababi
ebababi / functions.php
Created October 4, 2011 12:42
Cache FeedBurner circulation (subscribers) results in PHP
<?php
function get_feedburner_circulation($feedburner_id, $ttl = 86400) {
$cache = dirname(__FILE__) . '/cache/feedburner.txt';
// Check cache validity
if ( !file_exists($cache) || ( filemtime($cache) + $ttl - time() < 0 ) ) {
// try to get the feed data
$curl = curl_init('https://feedburner.google.com/api/awareness/1.0/GetFeedData?uri=' . $feedburner_id);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($curl);
@mhluska
mhluska / resume_json.rb
Last active March 3, 2017 23:42
Jekyll plugin for blog post on syncing resume with LinkedIn profile: http://mhluska.com/blog/2014/08/20/syncing-a-jekyll-blog-resume-with-your-linkedin-profile/
# _plugins/resume_json.rb
require 'oauth'
require 'yaml'
require 'json'
module Jekyll
class Resume < Jekyll::Generator
def format_date(date)
Date.new(date['year'], date['month']).strftime('%b %Y').to_s
@gboudreau
gboudreau / AuthyToOtherAuthenticator.md
Last active November 15, 2024 12:45 — forked from Ingramz/AuthyToOtherAuthenticator.md
Export TOTP tokens from Authy

Exporting your 2FA tokens from Authy to transfer them into another 2FA application

IMPORTANT - Update regarding deprecation of Authy desktop apps

Past August 2024, Authy stopped supported the desktop version of their apps:
See Authy is shutting down its desktop app | The 2FA app Authy will only be available on Android and iOS starting in August for details.

And indeed, after a while, Authy changed something in their backend which now prevents the old desktop app from logging in. If you are already logged in, then you are in luck, and you can follow the instructions below to export to tokens.

If you are not logged in anymore, but can find a backup of the necessary files, then restore those files, and re-install Authy 2.2.3 following the instructions below, and it should work as expected.

require 'digest/sha1'
require 'net/http'
def pwned?(password)
digest = Digest::SHA1.hexdigest(password).upcase
prefix = digest[0,5]
suffix = digest[5,256]
uri = URI.parse("https://api.pwnedpasswords.com/range/" + prefix)