Skip to content

Instantly share code, notes, and snippets.

View kuzminT's full-sized avatar

Timofey Kuzmin kuzminT

View GitHub Profile

This is a collection of Ubuntu fixes for Lenovo Legion 5i

Tested on: Lenovo Legion 5i with below specs:
AMD® Ryzen 7 4800h with radeon graphics × 16
NVIDIA Corporation / NVIDIA GeForce RTX 2060/PCIe/SSE2

1. GPU ISSUES for RTX 2060:

nvidia-driver-470 - HDMI doesn't have to work from the beginning
nvidia-driver-495 - HDMI works from the beginning, unstable (random reboots)\

@xieyuschen
xieyuschen / download_file.md
Last active March 20, 2024 15:19
Gin: download file with an simple api

Gin: download file with an simple api

func DownloadLicense(ctx *gin.Context) {
	content:="Download file here happliy"
	fileName := "hello.txt"
	ctx.Header("Content-Disposition", "attachment; filename="+fileName)
	ctx.Header("Content-Type", "application/text/plain")
	ctx.Header("Accept-Length", fmt.Sprintf("%d", len(content)))
	ctx.Writer.Write([]byte(content))
	ctx.JSON(http.StatusOK, gin.H{
@gjtorikian
gjtorikian / main.go
Created October 13, 2020 15:43
Heroku chat sample
package main
import (
"encoding/json"
"io"
"log"
"net/http"
"os"
"github.com/go-redis/redis"
@mimoo
mimoo / compress_tar_gzip.go
Last active May 27, 2024 20:01
How to compress a folder in Golang using tar and gzip (works with nested folders)
package main
import (
"archive/tar"
"bytes"
"compress/gzip"
"fmt"
"io"
"os"
"path/filepath"
@thiagozs
thiagozs / gomock.md
Last active July 3, 2024 14:59
Tutorial gomock

08/16/17 by  Sergey Grebenshchikov

No Comments

This is a quick tutorial on how to test code using the GoMock mocking library and the standard library testing package testing.

GoMock is a mock framework for Go. It enjoys a somewhat official status as part of the github.com/golang organization, integrates well with the built-in testing package, and provides a flexible expectation API.

@apoorv007
apoorv007 / asyncio_example.py
Last active April 26, 2020 20:54
Aynchronous programming with asyncio
import asyncio
# this is a coroutine definition
async def fake_network_request(request):
print('making network call for request: ' + request)
# simulate network delay
await asyncio.sleep(1)
return 'got network response for request: ' + request
@schollz
schollz / files.sh
Last active July 30, 2023 00:19
Go upload/recieve files via POST
#! /bin/bash
for n in {1..100}; do
dd if=/dev/urandom of=file$( printf %d "$n" ).bin bs=1 count=$(( RANDOM + 1024 ))
done
@mdamien
mdamien / 0readme.md
Last active February 22, 2024 12:11
404 link detector with scrapy

List all the broken links on your website

Requirements:

python3 and scrapy (pip install scrapy)

Usage

  • scrapy runspider -o items.csv -a site="https://yoursite.org" 1spider.py
  • python3 2format_results.py
@bastman
bastman / docker-cleanup-resources.md
Created March 31, 2016 05:55
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@Committing
Committing / .hgignore
Last active May 6, 2023 02:07
.hgignore specifically for Wordpress
# Compiled by Jack (Committing)
# https://gist.github.com/Committing/7bd55ff4615248b7cea0
# GIT version: https://gist.github.com/Committing/24700559b3c05bdd2e3921c12c16f134
#################################
## Target root files/folders
#################################
syntax: regexp