Skip to content

Instantly share code, notes, and snippets.

View xgdgsc's full-sized avatar

xgdgsc

  • Beijing,China
  • 05:16 (UTC +08:00)
View GitHub Profile
@xgdgsc
xgdgsc / powerplan.ahk
Last active February 4, 2022 05:29
switch power plan based on window name using ahk
#SingleInstance force
#warn
RyzenPowerPlanIDCheck()
{
objShell := ComObjCreate("WScript.Shell")
var := objShell.Exec("cmd /c powercfg /list").StdOut.ReadAll()
global powercfg_ids := ["381b4222-f694-41f0-9685-ff5bb260df2e","a1841308-3541-4fab-bc81-f71556f20b4a"]
for each, id in powercfg_ids
{
@xgdgsc
xgdgsc / gist:c97e96046ff77c49017e81919aba507b
Created February 19, 2021 03:01
linux 搜狗输入法 隐藏状态栏
进入sougou的配置目录
vim $HOME/.config/sogoupinyin/conf/env.ini
找到StatusAppearance 设置为
StatusAppearance=0
@xgdgsc
xgdgsc / clash filter auto switch.yml
Last active May 1, 2023 00:50
clash filter auto switch load-balance example
parsers: # array
- url: YOUR_URL
code: |
module.exports.parse = (raw,{ yaml }) => {
const rawObj = yaml.parse(raw)
var proxy_groups = rawObj["proxy-groups"]
var valid_arr = []
var select_i = 0
for(var i = 0; i < proxy_groups.length; i++) {
var obj = proxy_groups[i];
initialized
workspace/didChangeConfiguration
IntelliSense Engine = Default.
Autocomplete is enabled.
Enhanced Colorization is enabled.
Error squiggles are enabled if all header dependencies are resolved.
File exclude: **/.git
File exclude: **/.svn
File exclude: **/.hg
File exclude: **/CVS
@xgdgsc
xgdgsc / confirm.go
Created May 26, 2018 07:39 — forked from r0l1/confirm.go
Go (golang): How to ask for user confirmation via command line
/* MIT License
*
* Copyright (c) 2017 Roland Singer [roland.singer@desertbit.com]
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
@xgdgsc
xgdgsc / README-setup-tunnel-as-systemd-service.md
Created October 26, 2017 06:00 — forked from drmalex07/README-setup-tunnel-as-systemd-service.md
Setup a secure (SSH) tunnel as a systemd service. #systemd #ssh #ssh-tunnel #ssh-forward

README

Create a template service file at /etc/systemd/system/secure-tunnel@.service. The template parameter will correspond to the name of target host:

[Unit]
Description=Setup a secure tunnel to %I
After=network.target
@xgdgsc
xgdgsc / compressed_csv_reader.h
Created September 27, 2017 13:25
compressed_csv_reader
#pragma once
#include <iostream>
#include <sstream>
#include <vector>
#include <boost/algorithm/string.hpp>
#include <boost/iostreams/copy.hpp>
#include <boost/iostreams/filter/bzip2.hpp>
#include <boost/iostreams/filter/gzip.hpp>
#include <boost/iostreams/filtering_stream.hpp>
@xgdgsc
xgdgsc / pomo_reminder.py
Created September 18, 2017 13:46
pomotodo task switch reminder
import requests
import json
from datetime import datetime, timedelta
import os
if os.name == 'nt':
from win10toast import ToastNotifier
toaster = ToastNotifier()
//from config import *
POMO_URL='https://api.pomotodo.com/1/pomos'
@xgdgsc
xgdgsc / tail-slack.sh
Created June 28, 2017 15:11
tail-slack
#!/bin/bash
tail -n0 -F "$1" | while read LINE; do
(echo "$LINE" | grep -e "$3") && curl -X POST --silent --data-urlencode \
"payload={\"text\": \"$(echo $LINE | sed "s/\"/'/g")\"}" "$2";
done
@xgdgsc
xgdgsc / .bashrc
Created June 6, 2017 08:12 — forked from copperlight/.bashrc
Window Subsystem for Linux ssh-agent Configuraton
# ... more above ...
# wsfl bash is not a login shell
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
# ssh-agent configuration
if [ -z "$(pgrep ssh-agent)" ]; then
rm -rf /tmp/ssh-*