Skip to content

Instantly share code, notes, and snippets.

@hoangnh228
hoangnh228 / AuthyToOtherAuthenticator.md
Created September 5, 2021 15:26 — forked from gboudreau/AuthyToOtherAuthenticator.md
Export TOTP tokens from Authy

Generating Authy passwords on other authenticators


There is an increasing count of applications which use Authy for two-factor authentication. However many users who aren't using Authy, have their own authenticator setup up already and do not wish to use two applications for generating passwords.

Since I use 1Password for all of my password storing/generating needs, I was looking for a solution to use Authy passwords on that. I couldn't find any completely working solutions, however I stumbled upon a gist by Brian Hartvigsen. His post had a neat code with it to generate QR codes for you to use on your favorite authenticator.

His method is to extract the secret keys using Authy's Google Chrome app via Developer Tools. If this was not possible, I guess people would be reverse engineering the Android app or something like that. But when I tried that code, nothing appeared on the screen. My guess is that Brian used the

@hoangnh228
hoangnh228 / get_combinations.php
Created October 19, 2019 09:35 — forked from cecilemuller/get_combinations.php
PHP: Get all combinations of multiple arrays (preserves keys)
<?php
function get_combinations($arrays) {
$result = array(array());
foreach ($arrays as $property => $property_values) {
$tmp = array();
foreach ($result as $result_item) {
foreach ($property_values as $property_value) {
$tmp[] = array_merge($result_item, array($property => $property_value));
}
@hoangnh228
hoangnh228 / gist:bc82fa4b74e10409625dfd14bf0e88ed
Created March 7, 2019 03:44 — forked from JesseObrien/gist:7418983
Bind parameters into the SQL query for Laravel ORM
<?php
class MyModel extends Eloquent {
public function getSql()
{
$builder = $this->getBuilder();
$sql = $builder->toSql();
foreach($builder->getBindings() as $binding)
{
@hoangnh228
hoangnh228 / config.file
Last active February 2, 2018 09:06
homestead nginx config angular js in root and laravel in subfolder
location ^~ /serverapi {
alias /home/vagrant/Code/csmportal/serverapi;
try_files $uri $uri/ @serverapi;
location ~ \.php {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php5.6-fpm.sock;
fastcgi_param SCRIPT_FILENAME /home/vagrant/Code/csmportal/serverapi/public/index.php;
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Tapi map test</title>
<!-- Fonts -->
<link href="https://fonts.googleapis.com/css?family=Raleway:100,600" rel="stylesheet" type="text/css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
{
"always_show_minimap_viewport": true,
"bold_folder_labels": true,
"caret_extra_bottom": 2,
"caret_extra_top": 2,
"caret_extra_width": 2,
"caret_style": "phase",
"color_scheme": "Packages/User/SublimeLinter/Material Facebook (SL).tmTheme",
"drag_text": false,
"enable_tab_scrolling": false,
@hoangnh228
hoangnh228 / nginx+php+mysql_osx.md
Created November 22, 2016 08:58 — forked from laptrinhcomvn/nginx+php+mysql_osx.md
Set up on Mac OS X El Capitan: Nginx - PHP 5.6.x

Mac OS X El Capitan setup Nginx - PHP 5.6.x, MySQL 5.7.x, phpMyAdmin

1. Install homebrew

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
@hoangnh228
hoangnh228 / iterm2.md
Last active November 23, 2016 02:25
iterm2 cheatsheet

Shell Intergration (require enable Shell Intergration)

Function Shortcut
Show/hide commands history + B
Show/hide recent directories + Option + /

Tabs and Windows

Function | Shortcut

@hoangnh228
hoangnh228 / Install Composer using MAMP's PHP.md
Created October 26, 2016 02:28 — forked from irazasyed/Install Composer using MAMP's PHP.md
Instructions on how to change preinstalled Mac OS X PHP to MAMP's PHP Installation and then install Composer Package Management

Change default Mac OS X PHP to MAMP's PHP Installation and Install Composer Package Management


Instructions to Change PHP Installation


First, Lets find out what version of PHP we're running (To find out if it's the default version).

To do that, Within the terminal, Fire this command:

which php

@hoangnh228
hoangnh228 / simple-google-calendar-add-new-event.php
Created September 16, 2016 07:38
Google calendar quick setup for add new event
<?php
require_once __DIR__ . '/vendor/autoload.php';
session_start();
$client = new Google_Client();
$client->setAuthConfig('secret.json');
$client->addScope(Google_Service_Calendar::CALENDAR);