Skip to content

Instantly share code, notes, and snippets.

View mugli's full-sized avatar
🤷

Mehdi Hasan Khan mugli

🤷
View GitHub Profile
@mugli
mugli / bash_and_fish_links.md
Created January 24, 2019 14:52 — forked from pirate/bash_and_fish_links.md
Some cool sites to learn about bash & fish.
@mugli
mugli / ioredis-duplex-stream.js
Created January 23, 2019 16:15 — forked from matthax/ioredis-duplex-stream.js
IORedis Duplex Stream Example
/**
* MIT License
Copyright (c) 2018 Matthew D. Bark
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
@mugli
mugli / eval-hello.sh
Created January 9, 2019 11:12 — forked from bpo/eval-hello.sh
Redis Lua examples
redis-cli EVAL "$(cat hello.lua)" 0
@mugli
mugli / closure_table.md
Created December 12, 2018 05:09
Persistent tree structure using closure table in MySQL

Using closure tables to manage hierarchical relations in MySQL

Create DB tables

Create a table to represent tree nodes.

CREATE TABLE `tree_node` (
    `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
    `data_body` text,

node_deleted datetime DEFAULT NULL,

@mugli
mugli / homebrew_multiple_mysql_versions.md
Created December 10, 2018 05:48 — forked from benlinton/multiple_mysql_versions_for_development.md
Multiple MySQL Versions with Homebrew

Multiple MySQL Versions with Homebrew

For homebrew version 0.9.5.

brew -v # => Homebrew 0.9.5

Install the current version of mysql.

# Install current mysql version

brew install mysql

@mugli
mugli / findLongRunningOp.js
Created December 3, 2018 06:08 — forked from kylemclaren/findLongRunningOp.js
Find and (safely) kill long running MongoDB ops
db.currentOp().inprog.forEach(
function(op) {
if(op.secs_running > 5) printjson(op);
}
)
@mugli
mugli / query_finder.sql
Last active February 10, 2019 05:52 — forked from mezis/query_finder.sql
Finding long-running queries in MySQL
SELECT id, concat('kill ', id, ';') as kill_command, state, command, time, info
FROM information_schema.processlist
WHERE command <> 'Sleep'
AND info NOT LIKE '%PROCESSLIST%'
ORDER BY time DESC LIMIT 50;

Keybase proof

I hereby claim:

  • I am mugli on github.
  • I am mhasan (https://keybase.io/mhasan) on keybase.
  • I have a public key ASCwWUfWDZ5wFSs-4qU91rQQ9Nrf6mGDtt7_65QeUPb2Bgo

To claim this, I am signing this object:

@mugli
mugli / cloudSettings
Last active September 13, 2020 08:33
Visual Studio Code Settings Sync Gist
{"lastUpload":"2020-01-24T07:05:34.982Z","extensionVersion":"v3.4.3"}
@mugli
mugli / Oauth2.md
Created July 26, 2018 08:04 — forked from mziwisky/Oauth2.md
Oauth2 Explanation

OAUTH2

The Problem

I’m a web app that wants to allow other web apps access to my users’ information, but I want to ensure that the user says it’s ok.

The Solution

I can’t trust the other web apps, so I must interact with my users directly. I’ll let them know that the other app is trying to get their info, and ask whether they want to grant that permission. Oauth defines a way to initiate that permission verification from the other app’s site so that the user experience is smooth. If the user grants permission, I issue an AuthToken to the other app which it can use to make requests for that user's info.

Note on encryption

Oauth2 has nothing to do with encryption -- it relies upon SSL to keep things (like the client app’s shared_secret) secure.