Skip to content

Instantly share code, notes, and snippets.

View lshaf's full-sized avatar
💭
Working

L Shaf lshaf

💭
Working
View GitHub Profile
@lshaf
lshaf / termux.md
Created April 30, 2019 10:48
Best setting for termux
// ==UserScript==
// @name Anime Series Downloader
// @namespace https://gist.github.com/lshaf
// @version 1.0.1
// @description try to take over the world!
// @author L Shaf
// @match http*://animeseries.io/watch/*
// @match http*://*.animeseries.io/watch/*
// @run-at document-end
// @grant none
@lshaf
lshaf / do_notification.user.js
Last active July 12, 2019 14:58
to read all
// ==UserScript==
// @name Digital Ocean Notification Reader
// @namespace https://gist.github.com/lshaf
// @version 1.0.2
// @description try to take over the world!
// @author L Shaf
// @match https://cloud.digitalocean.com/notifications*
// @run-at document-end
// @grant none
// @downloadURL https://gist.github.com/lshaf/3f0ff89d97c296a2e53b2e5a4b1e6573/raw/924299546536a4febab8c2628697668aa6863ed2/do_notification.user.js
@lshaf
lshaf / gunicorn.init.d
Last active February 23, 2021 01:48 — forked from leplatrem/yourapp
gunicorn virtualenv init.d script (could be simpler with upstart)
#! /bin/bash
### BEGIN INIT INFO
# Provides: yourapp
# Required-Start: nginx
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: The main django process
# Description: The gunicorn process that receives HTTP requests
# from nginx
@lshaf
lshaf / gist:ccb68322b5d118085b0193414869f223
Created September 10, 2019 04:33 — forked from bkrauska/gist:9742260
DiffMerge git mergetool & difftool setup
Install http://download-us.sourcegear.com/DiffMerge/4.2.0/DiffMerge_4.2.0.697.stable_x64.msi
// this is an adaptation of http://adventuresincoding.com/2010/04/how-to-setup-git-to-use-diffmerge
Then run the following commands from the git bash
git config --global merge.tool diffmerge
git config --global mergetool.diffmerge.cmd "sgdm --merge --result=\$MERGED \$LOCAL \$BASE \$REMOTE"
@lshaf
lshaf / terminal-setting.json
Created October 14, 2019 13:55
Terminal Windows (Preview) Setting
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"globals" :
{
"alwaysShowTabs" : true,
"defaultProfile" : "{2c4de342-38b7-51cf-b940-2309a097f518}",
"initialCols" : 120,
"initialRows" : 30,
"keybindings" :
[
@lshaf
lshaf / updateKey.sh
Created March 15, 2020 05:55
update apt key when it's error or expired
sudo apt-key adv --refresh-keys --keyserver keyserver.ubuntu.com
RewriteEngine on
# Option 1: To rewrite "www.domain.com -> domain.com" uncomment the following lines.
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
# If a directory or a file exists, use the request directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward the request to index.php
RewriteRule . index.php
@lshaf
lshaf / wordwrap.cs
Created June 16, 2020 14:25
Word wrap in C Sharp
using System;
using System.Collections;
using System.Linq;
public class Program
{
class StringHelper
{
public static ArrayList WordWrap(string text, int maxLength = 86)
{
@lshaf
lshaf / mysql.lua
Last active August 13, 2020 11:50
Custom mysql lua script for vernemq.
-- /usr/share/vernemq/lua/auth/mysql.lua
-- Only replace the function
function auth_on_register(reg)
if reg.username ~= nil and reg.password ~= nil then
raw_client_id = reg.client_id
form_client_id = raw_client_id:gsub("#", "%")
results = mysql.execute(pool,
[[SELECT publish_acl, subscribe_acl
FROM vmq_auth_acl