Skip to content

Instantly share code, notes, and snippets.

Avatar

Seven askdaddy

View GitHub Profile
@askdaddy
askdaddy / bin.sh
Created Nov 15, 2021
list all users crontab
View bin.sh
awk -F: '{print $1}' /etc/passwd | xargs -i sudo crontab -u {} -l
View .bash_profile
#!/bin/bash
#### https://gist.github.com/hernamesbarbara/1937937
export TERM=xterm-color
export CLICOLOR=1
export GREP_OPTIONS='--color=auto'
# export LSCOLORS=Exfxcxdxbxegedabagacad
export LSCOLORS=gxfxcxdxbxegedabagacad # Dark lscolor scheme
# Don't put duplicate lines in your bash history
export HISTCONTROL=ignoredups
@askdaddy
askdaddy / config.txt
Created Nov 15, 2019
WSL terminal in GoLand
View config.txt
Settings > Tools > Terminal > Application settings
"C:\Windows\System32\bash.exe" --login -i -c zsh
View config.json
{
"algo": "cryptonight",
"api": {
"port": 0,
"access-token": null,
"worker-id": null,
"ipv6": false,
"restricted": true
},
"av": 0,
View buffer_io.h
bool writeDelimitedTo(
const google::protobuf::MessageLite& message,
google::protobuf::io::ZeroCopyOutputStream* rawOutput) {
// We create a new coded stream for each message. Don't worry, this is fast.
google::protobuf::io::CodedOutputStream output(rawOutput);
// Write the size.
const int size = message.ByteSize();
output.WriteVarint32(size);
@askdaddy
askdaddy / example.lua
Created Jan 29, 2021 — forked from mebens/example.lua
Doubly linked list in Lua
View example.lua
require("list")
local a = { 3 }
local b = { 4 }
local l = list({ 2 }, a, b, { 5 })
l:pop()
l:shift()
l:push({ 6 })
l:unshift({ 7 })
View ubuntu-setup-env.sh
#!/bin/bash
set -e
SSHD_LISTEN_ADDRESS=127.0.0.1
SSHD_PORT=2222
SSHD_FILE=/etc/ssh/sshd_config
SUDOERS_FILE=/etc/sudoers
# 0. update package lists
@askdaddy
askdaddy / loop.worker.ts
Created Dec 24, 2020
ts-loop base on setTimeout
View loop.worker.ts
export const fps: number = 10;
export const interval = fps > 0 ? 1000 / fps : 1000 / 30;
function _run(current: number, delta: number) {
console.log(`_run at ${current} + delta: ${delta}`);
// TODO do something here.
for(let i=0; i< 499999 ;++i){
let a = new Date().getTime() + i;
}
@askdaddy
askdaddy / READ.md
Created Nov 17, 2020
ubuntu18.04 IDEA中文输入问题(IBUS)
View READ.md

===

问题

输入3个汉字后不能继续输入,此时甚至不能切换输入法

解决

  • 修改ibus的快捷键防止冲突
  • Help>Edit Custom VM Options... 添加
View boost.cmake
include(ExternalProject)
include(GNUInstallDirs)
set(BOOST_CXXFLAGS "")
if (WIN32)
set(BOOST_BOOTSTRAP_COMMAND bootstrap.bat)
set(BOOST_BUILD_TOOL b2.exe)
set(BOOST_LIBRARY_SUFFIX -vc140-mt-1_63.lib)
else()
set(BOOST_BOOTSTRAP_COMMAND ./bootstrap.sh)