Skip to content

Instantly share code, notes, and snippets.

🤷‍♂
how to exit vim

Cryven codcodog

🤷‍♂
how to exit vim
Block or report user

Report or block codcodog

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@codcodog
codcodog / touchpad.sh
Created Aug 28, 2019
Dell 13 touchpad enable & disable.
View touchpad.sh
xinput list | grep "DLL082A:01" | awk -F'=' '{print $2}' | awk '{print $1}' | xargs xinput disable
xinput list | grep "DLL082A:01" | awk -F'=' '{print $2}' | awk '{print $1}' | xargs xinput enable
@codcodog
codcodog / distributed-lock.php
Last active Aug 7, 2019
Redis setnx 实现分布式锁
View distributed-lock.php
/**
* 当前 cron 触发的进程获取 redis 锁
*
* 主要是防止在跑 cron 时,上一个 cron 计算尚没完成,
* 从而导致,重复执行计算的情况.
*
* 例如:1 * * * * 的定时任务,一分钟内计算未完成,
* 又再次触发,则会出现重复计算的混乱情况.
*
@codcodog
codcodog / request.go
Created May 7, 2019
HTTP 请求示例
View request.go
package main
import (
"fmt"
"io/ioutil"
"net/http"
)
func main() {
req, err := http.NewRequest("GET", "https://cn.bing.com", nil)
View lines.go
package main
import (
"bufio"
"fmt"
"os"
)
func main() {
scanner := bufio.NewScanner(os.Stdin)
@codcodog
codcodog / cli.go
Last active Apr 28, 2019
golang 命令行
View cli.go
package main
import (
"flag"
"fmt"
"os"
)
func main() {
var (
View ctags-for-php-include-trait.sh
ctags --languages=php --regex-php='/^[ \t]*trait[ \t]+([a-z0_9_]+)/\1/t,traits/i' -R .
@codcodog
codcodog / getParam.js
Last active Mar 20, 2019
获取 URL GET 参数
View getParam.js
function getParam(paramName, defaultValue = '')
{
let url = location.search;
let params = new Object();
if (url.indexOf('?') != -1) {
url = url.slice(1);
strs = url.split('&');
strs.forEach(function (str) {
@codcodog
codcodog / copyToClipboard.html
Last active Mar 20, 2019
浏览器复制文本
View copyToClipboard.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<input id="el" type="text" value="Hello World." />
<button id="copy">复制</button>
</body>
View Makefile
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
You can’t perform that action at this time.