Skip to content

Instantly share code, notes, and snippets.

View sempr's full-sized avatar

Sempr sempr

  • Company-Not-Be-Named
  • Hangzhou
  • 21:00 (UTC +08:00)
View GitHub Profile
@miooochi
miooochi / auto-artifact-export.yml
Last active March 19, 2024 01:20
mosdns-v5 config template
---
- name: Update dat files
hosts: all
become: yes
vars:
- base_path: /etc/mosdns
- restart_daemon: yes
- daemon_service_name: mosdns
- clean_up_after: yes
@sempr
sempr / go.mod
Created August 9, 2022 07:28
Gin with httputil.ReverseProxy
module github.com/sempr/gin-reverse-proxy
go 1.18
require github.com/gin-gonic/gin v1.8.1
require (
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-playground/locales v0.14.0 // indirect
github.com/go-playground/universal-translator v0.18.0 // indirect
@ninedraft
ninedraft / adapter.go
Created July 17, 2020 08:40
Golang STD HTTP to gin middleware adapter
// Copyright 2020 Petrukhin Pavel
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
@ziaulrehman40
ziaulrehman40 / CheckboxAdapter.jsx
Created November 24, 2019 13:16
Shopify-polaris components wrappers for react-final-form
import React from 'react'
import { Checkbox } from '@shopify/polaris'
export default function CheckboxAdapter({ input, meta, ...rest }) {
return (
<Checkbox
{...input}
{...rest}
error={meta.touched && meta.error}
onChange={(value) => {
@sempr
sempr / replace-new-kernel.sh
Last active February 3, 2021 09:52
使用kexec来替换新内核
latestkernel=`ls -t /boot/vmlinuz-* | sed "s/\/boot\/vmlinuz-//g" | head -n1`
echo $latestkernel
kexec -l /boot/vmlinuz-${latestkernel} --initrd=/boot/initramfs-${latestkernel}.img --append="`cat /proc/cmdline`"
kexec -e
# 备注,其实和重启没啥两样, uptime也会清零重算,唯一的好处就是比重启要快一点点
# remove old kernels on centos 8
dnf remove --oldinstallonly --setopt installonly_limit=1 kernel
@whusnoopy
whusnoopy / grep_money.py
Last active August 29, 2015 14:04
grep money count in wiki
# coding: utf8
from argparse import ArgumentParser
def color_str(o_str, color_num):
return '\033[1;{}m{}\033[m'.format(color_num, o_str)
def red_str(o_str):