Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Technoknol technoknol

🎯
Focusing
View GitHub Profile
@technoknol
technoknol / Doctrine SubQuery using getDQL .php
Last active May 18, 2021
Doctrine SubQuery using getDQL
View Doctrine SubQuery using getDQL .php
<?php
$queryBuilder = $this->entityManager->createQueryBuilder();
$queryBuilder2 = $this->entityManager->createQueryBuilder();
$subQuery = $queryBuilder2->select('COUNT(fr.status)')
->from(FeedbackRequest::class, 'fr')
->where('fr.giverId = iu.userId')
->groupBy('fr.status')
@technoknol
technoknol / custom-selector-redux-toolkit.js
Created May 3, 2021
Custom Selector Redux Toolkit with Entity Adapter
View custom-selector-redux-toolkit.js
import { createAsyncThunk, createDraftSafeSelector, createEntityAdapter, createSlice } from '@reduxjs/toolkit';
import axios from 'axios';
const socialAccountsAdapter = createEntityAdapter({});
export const getSocialAccounts = createAsyncThunk('app/getSocialAccounts', async () => {
const response = await axios.get(`/SocialAccount/my-connected-accounts`);
// return []
return response.data.data;
});
@technoknol
technoknol / create-react-app SSL generate Windows.md
Last active May 1, 2021
create-react-app SSL generate Windows
View create-react-app SSL generate Windows.md
  1. Install OpenSSL on your windows machine.

  2. Open Gitbash and Go to your project root folder.

  3. fire below commands

openssl req -x509 -newkey rsa:2048 -keyout keytmp.pem -out cert.pem -days 365 openssl rsa -in keytmp.pem -out key.pem

  1. Now change the start script in the package.json file to:
@technoknol
technoknol / cygwin.reg
Created Jan 23, 2021
Cygwin context menu in Windows Explorer.
View cygwin.reg
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\Background\shell\z_cygwin_bash]
@="Cygwin Here"
"Icon"="C:\\cygwin64\\Cygwin.ico"
[HKEY_CLASSES_ROOT\Directory\Background\shell\z_cygwin_bash\command]
@="C:\\cygwin64\\bin\\mintty.exe /bin/sh -lc 'cd \"`cygpath \"%V\"`\"; exec bash'"
[HKEY_CLASSES_ROOT\Directory\shell\z_cygwin_bash]
@technoknol
technoknol / site.conf
Created Jul 23, 2020
.NET core app with SignalR with SSL with Apache Reverse Proxy Configuration
View site.conf
<IfModule mod_ssl.c>
<VirtualHost *:443>
RewriteEngine On
ProxyPreserveHost On
ProxyRequests Off
# allow for upgrading to websockets
RewriteEngine On
RewriteCond %{HTTP:Upgrade} =websocket [NC]
RewriteRule /(.*) ws://localhost:5000/$1 [P,L]
View gist:1fd09a97b3c0f65fb6921b5e4107ff45
// to prevent empty objects being pushed in resule like 'eventWinners' : [ {} ]
// if there are no winners found, after lookup and unwind.
$group: {
_id: '$_id',
root: {
$mergeObjects: '$$ROOT',
},
eventWinners: {
$push: {
@technoknol
technoknol / mousewheel.sh
Created Jul 1, 2020
Increase mouse wheel speed in Ubuntu
View mousewheel.sh
Source : https://web.archive.org/web/20200701114024/https://dev.to/bbavouzet/ubuntu-20-04-mouse-scroll-wheel-speed-536o
sudo apt install imwheel
chmod +x mousewheel.sh
./mousewheel.sh
@technoknol
technoknol / deploy.bat
Created Oct 18, 2019
SSH into server and run commands - DEPLOYMENT on Linux server from Windows Server #deployment
View deploy.bat
C:\path\to\putty\PLINK.EXE 167.XXX.XXX.XXX -l root -i C:\path\to\private\key\private.ppk (cd /commands\to\run\separated\by\semicolon;git pull)
View AppServiceContainer(use statements).php
<?php
use GuzzleHttp\Client;
use GuzzleHttp\HandlerStack;
use GuzzleHttp\MessageFormatter;
use GuzzleHttp\Middleware;
use Illuminate\Support\ServiceProvider;
use Monolog\Handler\RotatingFileHandler;
use Monolog\Logger;