Skip to content

Instantly share code, notes, and snippets.

View mrqwer88's full-sized avatar

Sergei Mamonov mrqwer88

  • https://fastvps.ee/
View GitHub Profile
@burik666
burik666 / crontab_wrapper.sh
Created June 5, 2018 11:07
crontab remove confirmation wrapper
#!/bin/bash
# alias crontab=/path/to/crontab_wrapper.sh
while getopts ":r" opt
do
case $opt in
r)
read -r -n 1 -p "Do really want to remove current crontab? [Y/n]" confirm
echo
if [ "$confirm" != "Y" ]; then
exit 1
@aikoncwd
aikoncwd / bin2dat.py
Created January 10, 2018 09:59
Python 3.x - bin2dat.py: Convert Intel CPU microcode binary format to text format.
#!/usr/bin/env python
# coding=utf-8
"""bin2dat.py: Convert Intel CPU microcode binary format to text format."""
__author__ = "H. Fischer"
__copyright__ = "Copyright 2017, HF"
__license__ = "GPL"
__version__ = "3"
@nguyendangminh
nguyendangminh / favicon.ico.go
Last active August 21, 2023 16:05
Serve favicon.ico in Golang
...
func faviconHandler(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, "relative/path/to/favicon.ico")
}
...
func main() {
http.HandleFunc("/favicon.ico", faviconHandler)
}
@pavel-odintsov
pavel-odintsov / vimrc
Last active May 8, 2022 13:23
vimrc_odintsov
"
" First of all, pleae install latest vim for convinience: https://launchpad.net/~jonathonf/+archive/ubuntu/vim
" Then install vim go
" git clone https://github.com/fatih/vim-go.git ~/.vim/pack/plugins/start/vim-go
"
" Fix arrow keys that display A B C D on remote shell:
" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
@jpillora
jpillora / sshd.go
Last active December 17, 2023 16:27
Go SSH server complete example - Read more here https://blog.gopheracademy.com/go-and-ssh/
// A small SSH daemon providing bash sessions
//
// Server:
// cd my/new/dir/
// #generate server keypair
// ssh-keygen -t rsa
// go get -v .
// go run sshd.go
//
// Client:
@michaljemala
michaljemala / tls-client.go
Last active May 31, 2024 02:51
SSL Client Authentication Golang sample
package main
import (
"crypto/tls"
"crypto/x509"
"flag"
"io/ioutil"
"log"
"net/http"
)
@labeneator
labeneator / buddyinfo.py
Created March 15, 2014 21:38
Pretty prints /proc/buddyinfo
#!/usr/bin/env python
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 textwidth=79 autoindent
"""
Python source code
Last modified: 15 Feb 2014 - 13:38
Last author: lmwangi at gmail com
Displays the available memory fragments
by querying /proc/buddyinfo
@dmitshur
dmitshur / gist:6927554
Last active September 17, 2023 07:35
[Legacy GOPATH mode] How to `go get` private repos using SSH key auth instead of password auth.

WARNING: This gist was created in 2013 and targets the legacy GOPATH mode. If you're reading this in 2021 or later, you're likely better served by reading https://tip.golang.org/cmd/go/#hdr-Configuration_for_downloading_non_public_code and https://golang.org/ref/mod#private-modules.

$ ssh -A vm
$ git config --global url."git@github.com:".insteadOf "https://github.com/"
$ cat ~/.gitconfig
[url "git@github.com:"]
	insteadOf = https://github.com/
$ go get github.com/private/repo && echo Success!
Success!