Skip to content

Instantly share code, notes, and snippets.


Sangam Kumar Shrestha 2shrestha22

View GitHub Profile
2shrestha22 /
Last active March 6, 2023 16:11
Helper script to flash Magisk for non A/B device.
# To run this:
# bash <(curl -sL
echo -e "Helper srcipt to flash Magisk patched boot.img for non A/B device...\n"
if adb shell getprop | grep -q true; then
View GlobalMenu KDE GTK Electron
libdbusmenu (for Fedora)
View 30-touchpad.conf
Section "InputClass"
Identifier "touchpad"
Driver "libinput"
MatchIsTouchpad "on"
Option "Tapping" "on"
Option "NaturalScrolling" "true"
2shrestha22 / freezed_snippet.code-snippets
Last active July 31, 2022 21:08
Freezed Snippet for VS Code. ctrl+shift+p - configure user snippet - add new global snippet - paste this
View freezed_snippet.code-snippets
// by ResoCoder
"Part statement": {
"prefix": "pts",
"body": [
"part '${TM_FILENAME_BASE}.g.dart';",
"description": "Creates a filled-in part statement"
2shrestha22 / wp.conf
Created July 13, 2021 16:45
WordPress nginx config
View wp.conf
# /etc/nginx/snippets/wp.conf
# include inside server block
index index.php;
location / {
# try to serve static file if not found then directory then php
# include the "?$args" part so non-default permalinks doesn't break when usi>
try_files $uri $uri/ /index.php?$args;
2shrestha22 / _common.conf
Created June 29, 2021 01:01 — forked from Daniel15/_common.conf
WordPress config with WP Super Cache for Nginx
View _common.conf
# /etc/nginx/snippets/wordpress/common.conf
index index.php;
# Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac).
location ~ /\. {
deny all;
# Block PHP files in uploads, content, and includes directory.
location ~* /(?:uploads|files|wp-content|wp-includes)/.*\.php$ {
2shrestha22 / .md
Created May 14, 2021 16:10 — forked from joepie91/.md
Running a Node.js application using nvm as a systemd service
View .md

Read this first!

Hi there! Since this post was originally written, nvm has gained some new tools, and some people have suggested alternative (and potentially better) approaches for modern systems. Make sure to have a look at the comments to this article, before following this guide!

The original article

Trickier than it seems.

View repeatingAdInsideListview.dart
//where _kAdIndex is an int and after each -kAdIndex in the listView Ad is displayed
controller: _scrollController,
cacheExtent: 20,
itemCount: data.layoutList.length +
(data.layoutList.length ~/ _kAdIndex),
itemBuilder: (BuildContext context, int index) {
if (index != 0 && (index + 1) % (_kAdIndex + 1) == 0) {
View regular_expressions.dart
class RegX {
static final RegExp _emailRegExp = RegExp(
static final RegExp _nonDigitsExp = RegExp(r'[^\d]');
static final RegExp _anyLetter = RegExp(r'[A-Za-z]');
static final RegExp _phoneRegExp = RegExp(r'^\d{7,15}$');
static final RegExp _ipv4RegExp = RegExp(
static final RegExp _ipv6RegExp = RegExp(