Skip to content

Instantly share code, notes, and snippets.

View 2shrestha22's full-sized avatar
🌀
Fluttering

Sangam Kumar Shrestha 2shrestha22

🌀
Fluttering
View GitHub Profile
@2shrestha22
2shrestha22 / README.md
Created November 24, 2023 16:33 — forked from zhiguangwang/README.md
Installing and running shadowsocks on Ubuntu Server

Installing and running shadowsocks on Ubuntu Server

16.10 yakkety and above

  1. Install the the shadowsocks-libev package from apt repository.

     sudo apt update
     sudo apt install shadowsocks-libev
    
  2. Save ss.json as /etc/shadowsocks-libev/config.json.

@2shrestha22
2shrestha22 / magisk_flash.sh
Last active March 6, 2023 16:11
Helper script to flash Magisk for non A/B device.
#!/bin/bash
# To run this:
# bash <(curl -sL https://gist.githubusercontent.com/2shrestha22/b2f15066c1627085e0913ac52d243d62/raw/2c477da35d44b77a510783a1d1494cc90feb9217/magisk_flash.sh)
BOOT_IMAGE_FILE_NAME="boot.img"
BOOT_IMAGE_FILE_PATH="./$BOOT_IMAGE_FILE_NAME"
echo -e "Helper srcipt to flash Magisk patched boot.img for non A/B device...\n"
if adb shell getprop ro.build.ab_update | grep -q true; then
libdbusmenu-glib
libdbusmenu (for Fedora)
Section "InputClass"
Identifier "touchpad"
Driver "libinput"
MatchIsTouchpad "on"
Option "Tapping" "on"
Option "NaturalScrolling" "true"
EndSection

TLP 1.4 Test: Battery Care for Lenovo Laptops (non-ThinkPad series)

Read the overview document first.

Supported Features

Lenovo laptop series using the ideapad_laptop driver have a feature called 'battery conservation mode', basically a fixed stop charge threshold at 60%. The hardware behaviour is:

  1. Connected to the charger, charging stops when the charge level reaches the stop threshold
@2shrestha22
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
// by ResoCoder
// https://github.com/rrousselGit/freezed/issues/85#issuecomment-593908291
{
"Part statement": {
"prefix": "pts",
"body": [
"part '${TM_FILENAME_BASE}.g.dart';",
],
"description": "Creates a filled-in part statement"
},
@2shrestha22
2shrestha22 / wp.conf
Created July 13, 2021 16:45
WordPress nginx config
# /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
2shrestha22 / _common.conf
Created June 29, 2021 01:01 — forked from Daniel15/_common.conf
WordPress config with WP Super Cache for Nginx
# /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
2shrestha22 / .md
Created May 14, 2021 16:10 — forked from joepie91/.md
Running a Node.js application using nvm as a systemd service

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.

//where _kAdIndex is an int and after each -kAdIndex in the listView Ad is displayed
ListView.builder(
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) {
print(index);