Skip to content

Instantly share code, notes, and snippets.

View mohitt's full-sized avatar
🎯
Focusing

Mohit Thakral mohitt

🎯
Focusing
View GitHub Profile
@mohitt
mohitt / another displayplacer.sh
Last active December 17, 2019 17:15
4 Monitors Display
displayplacer "id:0E0042C0-B227-4AD6-015B-5AF8116D137F res:1920x1080 hz:60 color_depth:4 scaling:off origin:(0,0) degree:0" "id:17E22855-A931-833E-8314-5CE8FFA63380 res:1920x1080 hz:60 color_depth:4 scaling:off origin:(0,-1080) degree:0" "id:D9534633-F47D-42FF-FA84-857343474BE8 res:1920x1080 hz:60 color_depth:4 scaling:off origin:(-1920,0) degree:0" "id:2131DD01-FB84-952C-5F7B-02BEEF31621F res:1920x1080 hz:60 color_depth:4 scaling:off origin:(-1920,-1080) degree:0"
@mohitt
mohitt / Powershell
Last active December 3, 2019 18:47
Delete All Windows Temp files
Set-Location “C:\Windows\Temp”
Remove-Item * -recurse -force
Set-Location “C:\Windows\Prefetch”
Remove-Item * -recurse -force
Set-Location “C:\Documents and Settings”
Remove-Item “.\*\Local Settings\temp\*” -recurse -force
Set-Location “C:\Users”
let mapleader=" "
nnoremap <Leader>ve :e ~/.ideavimrc<CR>
nnoremap <Leader>vl :source ~/.ideavimrc<CR>
set clipboard=unnamedplus,unnamed
set nu
set rnu
set is
"
nmap <Leader>f :action GotoFile<CR>
nmap <Leader>s :action FileStructurePopup<CR>
--- Actions ---
$Copy <M-C>
$Cut <M-X> <S-Del>
$Delete <Del> <BS> <M-BS>
$LRU
$Paste <M-V>
$Redo <M-S-Z> <A-S-BS>
$SearchWeb
$SelectAll <M-A>
$Undo <M-Z>
@mohitt
mohitt / webpack.dev.js
Created October 5, 2019 04:45
Headers for CORS
,
headers: {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods":
"GET, POST, PUT, DELETE, PATCH, OPTIONS",
"Access-Control-Allow-Headers":
"X-Requested-With, content-type, Authorization"
}
export SENDGRID_API_KEY='YOUR_API_KEY'
curl --request POST \
--url https://api.sendgrid.com/v3/mail/send \
--header "Authorization: Bearer $SENDGRID_API_KEY" \
--header 'Content-Type: application/json' \
--data '{"personalizations": [{"to": [{"email": "test@example.com"}]}],"from": {"email": "test@example.com"},"subject": "Sending with SendGrid is Fun","content": [{"type": "text/plain", "value": "and easy to do anywhere, even with cURL"}]}'
@mohitt
mohitt / Enable PS Remoting
Created August 11, 2019 17:01
Enable PS Remoting
Set-NetConnectionProfile -interfacealias "vEthernet (Default Switch)" -NetworkCategory Private
Enable-PSRemoting -Force
require('request-to-curl');
require('request-debug')(request, function(type, data, r) {
console.log(r.req.toCurl());
// put your request or response handling logic here
});
<?php
$servername = "cy-db-c";
$database = "cloudyogi_wp";
$username = "cloudyogi_wp";
$password = "localhost";
// Create connection
$conn = new mysqli($servername, $username, $password);
// Check connection
if ($conn->connect_error) {
(function() {
var _open = window.open;
window.open = function(str) {
console.log(JSON.stringify(arguments));
console.log(navigator.userAgent);
_open.apply(window, arguments);
};
})();