Skip to content

Instantly share code, notes, and snippets.

View waltercool's full-sized avatar

WalterCool waltercool

View GitHub Profile
import time
import os
import logging
import random
from datasets import load_dataset
class QuantAutoGPTQ:
def __init__(self, model_name_or_path, output_dir, dataset,
num_samples=128, trust_remote_code=False, cache_examples=True,
use_fast=True, use_triton=False, bits=[4], group_size=[128], damp=[0.01],
@waltercool
waltercool / process_ucode.sh
Last active April 2, 2021 18:35
Process Intel Microcode for your system only.
#!/bin/sh
# This tool requires git and iucode_tool.
# iucode_tool can be found at most repositories, or https://gitlab.com/iucode-tool/
#
# This script is NOT DESIGNED to be run as root. You must manually copy the output at the
# intel firmware folder. This is for security reasons.
MICROCODE_DATA="/tmp/microcode_data"
OUTPUT="microcodes"
How to connect USB through debug console
device_add usb-host,vendorid=0xL33T,productid=0xDEMO,id=whatever
(Obtain values from L33T and DEMO with lsusb)
Make sure to provide QEMU access to /dev/bus/usb/X/Y, take X and Y from dmesg values
@waltercool
waltercool / gist:0723f53ed479c25061bcdb1178198c97
Last active August 24, 2020 09:44
ffmpeg personal swissknife
# Compress x265 with deinterlace using Cuda
ffmpeg -hwaccel cuvid -i <INPUT> -pix_fmt p010le -vf yadif -c:v hevc_nvenc -preset slow -acodec copy <OUTPUT> #NOT WORKING ANYMORE
ffmpeg -i <INPUT> -vf yadif=parity=auto -vcodec hevc_nvenc -acodec copy -preset slow <OUTPUT>
# Merge Video+Audio
ffmpeg -i <Video> -i <Audio> -codec copy -shortest <OUTPUT>
# Extract audio from Video under Mono
ffmpeg -i <VIDEO> -vn -ac 1 <Audio>
@waltercool
waltercool / gist:dfe52ad1868939fd36825c565363e4a5
Last active February 15, 2019 22:56
Sidekiq Swiss Knife
# Clear all sidekiq scheduled
require 'sidekiq/api'
Sidekiq::ScheduledSet.new.clear
# Clear an specific queue by job name
jobs = Sidekiq::ScheduledSet.new.select {|retri| retri.klass == 'job_name' }
jobs.each(&:delete)
@waltercool
waltercool / vimdiff.md
Created January 18, 2019 19:50 — forked from mattratleph/vimdiff.md
vimdiff cheat sheet

vimdiff cheat sheet

##git mergetool

In the middle file (future merged file), you can navigate between conflicts with ]c and [c.

Choose which version you want to keep with :diffget //2 or :diffget //3 (the //2 and //3 are unique identifiers for the target/master copy and the merge/branch copy file names).

:diffupdate (to remove leftover spacing issues)

:only (once you’re done reviewing all conflicts, this shows only the middle/merged file)

@waltercool
waltercool / varnish-purge-cache.sh
Created October 16, 2018 23:18 — forked from andrezrv/varnish-purge-cache.sh
Purge all Varnish cache.
# Purge all Varnish cache
varnishadm "ban req.url ~ /"
@waltercool
waltercool / gist:b3247dfc562b6e29683295918d49f323
Last active October 12, 2018 14:51
Excluding ElasticSearch node and migrate all it data for shutdown or maintainance operations
curl -XPUT <hostname-or-IP>:9200/_cluster/settings -H 'Content-Type: application/json' -d '{
"transient" :{
"cluster.routing.allocation.exclude._ip" : "X.X.X.X"
}
}'
@waltercool
waltercool / gist:07b66e42f9e66fafaa9945e2a2b88206
Last active February 26, 2019 15:10
Postgresql Backup&Restore
Backup: pg_dump -Fc -f /path/to/backup.dump
Restore: pg_restore -U <USER> -h <HOST> -d <DATABASE> -Fc -Oxc backup.dump
@waltercool
waltercool / enum.py
Created May 17, 2018 15:13 — forked from b1naryth1ef/enum.py
PeeWee Postgres Enum Field
from peewee import *
class BModel(Model):
class Meta:
database = db
@classmethod
def create_table(cls, *args, **kwargs):
for field in cls._meta.get_fields():
if hasattr(field, "pre_field_create"):