Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/bash
awk -F':' '{print $6}' /etc/passwd |sort |uniq | while read line
do
if [ -e "${line}/.ssh/authorized_keys" ]; then
echo ${line}
for i in $(seq 1 $(wc -l ${line}/.ssh/authorized_keys |awk '{print $1}')); do
sed -n ${i}p ${line}/.ssh/authorized_keys |grep -v -e '^\s*#' -e '^\s*$' |grep -q -e 'ssh-rsa ' -e 'ssh-dsa ' -e 'ssh-dss ' -e 'ssh-ed25519 '
if [ $? -eq 0 ]; then
ssh-keygen -l -f <(sed -n ${i}p ${line}/.ssh/authorized_keys)
@akase244
akase244 / EngineersBlog-oauth1-client-Twitter.php
Created August 5, 2017 12:13
oauth1-client/src/Client/Server/Twitter.php
<?php
/**
* {@inheritDoc}
*/
public function urlUserDetails()
{
return 'https://api.twitter.com/1.1/account/verify_credentials.json?include_email=true';
}
@akase244
akase244 / EngineersBlog-LaravelSocialite-GithubProvider.php
Created August 5, 2017 11:35
socialite/src/Two/GithubProvider.php
<?php
/**
* The scopes being requested.
*
* @var array
*/
protected $scopes = ['user:email'];
@akase244
akase244 / EngineersBlog-LaravelSocialite-FacebookProvider.php
Created August 5, 2017 11:03
socialite/src/Two/FacebookProvider.php
<?php
/**
* The scopes being requested.
*
* @var array
*/
protected $scopes = ['email'];
@akase244
akase244 / EngineersBlog-LaravelSocialite-OauthController-getEmail.php
Last active August 5, 2017 10:56
app/Http/Controllers/Auth/OauthController.php
<?php
public function handleProviderCallback($provider)
{
$oauthUser = Socialite::driver($provider)->user();
dd($oauthUser->getEmail());
}
<?php
if (! function_exists('notify_to_analytics')) {
function notify_to_analytics($target_page)
{
$params = [];
$params['v'] = '1';
$params['t'] = 'pageview';
$params['tid'] = 'UA-XXXXXXXX-XX';
$params['cid'] = sprintf(
'%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
@akase244
akase244 / EngineersBlog-LaravelSocialite-SocialiteServiceProvider.php
Last active August 30, 2016 03:31
app/Socialite/SocialiteServiceProvider.php
<?php
namespace App\Socialite;
use Laravel\Socialite\SocialiteServiceProvider as OriginalSocialiteServiceProvider;
class SocialiteServiceProvider extends OriginalSocialiteServiceProvider
{
public function register()
{
@akase244
akase244 / EngineersBlog-LaravelSocialite-SocialiteManager.php
Last active August 30, 2016 03:31
app/Socialite/SocialiteManager.php
<?php
namespace App\Socialite;
use Laravel\Socialite\SocialiteManager as OriginalSocialiteManager;
class SocialiteManager extends OriginalSocialiteManager
{
protected function createFacebookDriver()
{
@akase244
akase244 / EngineersBlog-LaravelSocialite-FacebookProvider.php
Last active August 30, 2016 03:31
app/Providers/FacebookProvider.php
<?php
namespace App\Providers;
use Laravel\Socialite\Two\FacebookProvider as OriginalFacebookProvider;
class FacebookProvider extends OriginalFacebookProvider
{
protected function getUserByToken($token)
{