Skip to content

Instantly share code, notes, and snippets.

View asfaltboy's full-sized avatar

Pavel Savchenko asfaltboy

View GitHub Profile
@kkoomen
kkoomen / vim-auto-plug-upgrade-every-week.md
Last active July 30, 2023 05:47
Vim-Plug: Run PlugUpdate every week automatically

This snippet will check every time you run Vim whether it updated all your Plug packages for you. It will do this once a week automatically for you.

Add the following to your .vimrc:

function! OnVimEnter() abort
  " Run PlugUpdate every week automatically when entering Vim.
  if exists('g:plug_home')
    let l:filename = printf('%s/.vim_plug_update', g:plug_home)
 if !filereadable(l:filename)
@frozenice
frozenice / hddperftest
Last active September 29, 2023 22:06
quick perf test for the new Hetzner cloud volumes
# nbg1-dc3, CX11, Ubuntu 20.04, 10 GB EXT4 Volume
# local SSD
root@voltest:~# hdparm -Tt /dev/sda
/dev/sda:
Timing cached reads: 14624 MB in 1.99 seconds = 7341.48 MB/sec
@sloanlance
sloanlance / jq_jsonl_conversion.md
Last active May 3, 2024 10:26
jq: JSONL ↔︎ JSON conversion

jq: JSONL ↔︎ JSON conversion

Prerequisites

  • jqhttps://jqlang.github.io/jq/ — "like sed for JSON data"

    There are several options available for installing jq. I prefer to use Homebrew: brew install jq

  1. JSONL → JSON

@aasmith
aasmith / nested-json.sh
Created September 19, 2017 21:23
How to decode nested json with jq
# Typical use-case is decoding an AWS STS message. The DecodedMessage key contains escaped JSON.
jq '.DecodedMessage | fromjson | .' message.json
@SheldonWangRJT
SheldonWangRJT / Convert .mov or .MP4 to .gif.md
Last active May 3, 2024 22:39
Convert Movie(.mov) file to Gif(.gif) file in one command line in Mac Terminal

This notes is written by Sheldon. You can find me with #iOSBySheldon in Github, Youtube, Facebook, etc.

Need

Convert .mov/.MP4 to .gif

Reason

As a developer, I feel better to upload a short video when I create the pull request to show other viewers what I did in this PR. I tried .mov format directly got after finishing recording screen using Quicktime, however, gif offers preview in most web pages, and has smaller file size.

This is not limited to developer, anyone has this need can use this method to convert the files.

Run go install and

  • gogitlocalstats -add /path/to/folder will scan that folder and its subdirectories for repositories to scan
  • gogitlocalstats -email your@email.com will generate a CLI stats graph representing the last 6 months of activity for the passed email. You can configure the default in main.go, so you can run gogitlocalstats without parameters.

Being able to pass an email as param makes it possible to scan repos for collaborators activity as well.

License: CC BY-SA 4.0

@pierrejoubert73
pierrejoubert73 / markdown-details-collapsible.md
Last active May 2, 2024 16:19
How to add a collapsible section in markdown.

How to add a collapsible section in markdown

1. Example

Click me

Heading

  1. Foo
  2. Bar
    • Baz
  • Qux
@ahmetb
ahmetb / gcrgc.sh
Last active February 26, 2024 09:14
Script to clean up Google Container Registry images pushed before a particular date
#!/bin/bash
# Copyright © 2017 Google Inc.
# 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
@TauPan
TauPan / conftest.py
Last active July 18, 2018 13:31 — forked from asfaltboy/conftest.py
A pytest fixture to test Django data migrations
# based on https://gist.github.com/asfaltboy/b3e6f9b5d95af8ba2cc46f2ba6eae5e2
# based on https://gist.github.com/blueyed/4fb0a807104551f103e6
from django.db import connection
from django.db.migrations.executor import MigrationExecutor
from django.core.management import call_command
import pytest
@simonw
simonw / recover_source_code.md
Last active January 16, 2024 08:13
How to recover lost Python source code if it's still resident in-memory

How to recover lost Python source code if it's still resident in-memory

I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6

Attach a shell to the docker container

Install GDB (needed by pyrasite)

apt-get update && apt-get install gdb