Skip to content

Instantly share code, notes, and snippets.

View 2shrestha22's full-sized avatar
💙
Dart / Flutter

Sangam Kumar Shrestha 2shrestha22

💙
Dart / Flutter
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
@2shrestha22
2shrestha22 / cloudflare-worker-edge-cache.js
Last active February 23, 2023 05:47
Cloudflare workers script to enable edge-cache. Use Official cloudflare wordpress pulgin for auto cache purge management
// Stop CF edge from caching your site when specific wordpress cookies are present
// script found in https://www.mmaton.com/2018/07/02/cloudflare-cache-anonymous-requests/
addEventListener('fetch', event => {
event.respondWith(noCacheOnCookie(event.request))
})
async function noCacheOnCookie(request) {
// Determine which group this request is in.
const cookie = request.headers.get('Cookie')
@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"
},
libdbusmenu-glib
libdbusmenu (for Fedora)
Section "InputClass"
Identifier "touchpad"
Driver "libinput"
MatchIsTouchpad "on"
Option "Tapping" "on"
Option "NaturalScrolling" "true"
EndSection
<?php
//--------------------------------------------------------------
//--------------------------------------------------------------
//---------COPY CODE BELOW THIS LINE----------------------------
//Adding adsense ad unit inside the article
//Insert ads after every third paragraph of single post content.
#modify necessary
<VirtualHost *:80>
DocumentRoot "D:/xampp/htdocs/"
ServerName localhost
</VirtualHost>
#we add this to make sure we can access to open PHPmyAdmin from http://localhost/phpmyadmin
#DocumentRoot - the root of the web server in your machine. In XAMPP it is ../xampp/htdocs/
<VirtualHost *:80>

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 / 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;
}