Skip to content

Instantly share code, notes, and snippets.

View ppetr's full-sized avatar
🤞
I may be slow to respond.

Petr ppetr

🤞
I may be slow to respond.
View GitHub Profile
@nh2
nh2 / git-signoff-rebase.gitconfig
Last active April 13, 2018 18:04
How to sign off a whole branch in git
[alias]
# Usage: git signoff-rebase [base-commit]
signoff-rebase = "!EDITOR='sed -i -re s/^pick/e/' sh -c 'git rebase -i $1 && while test -f .git/rebase-merge/interactive; do git commit --amend --signoff --no-edit && git rebase --continue; done' -"
# Ideally we would use GIT_SEQUENCE_EDITOR in the above instead of EDITOR but that's not supported for git < 1.7.8.
@zombiecalypse
zombiecalypse / vim-html-markdown
Created June 24, 2014 22:12
Editing Google Docs locally as markdown with vim
#!/bin/sh
# Use as google docs edit --title "Reviews Regex Parse" --editor vim-html-markdown --format htm
file=$1
markdown=`tempfile --suffix=.mdown`
# Convert to markdown with pandocs
pandoc "$file" -f html -t markdown -o $markdown
# Edit the markdown file
@lonetwin
lonetwin / custom_sftp.py
Last active January 14, 2023 14:36
Replacing openssh's external sftp server with a custom sftp server based on paramiko [DEPRECATED -- please see comment]
#!/usr/bin/env python
# A more detailed explaination will come as a blog post soon, but in brief,
# here is the problem that led to this:
#
# For various reasons we have a requirement to implement an 'sftp' like
# abstraction/interface for a service that we provide. Basically we need to
# present objects in our application as a filesystem accessible over sftp.
#
# The way we have decided to go about this is to replace the 'standard' openssh
# sftp subsystem command entry in /etc/ssh/sshd_config on our servers with our
@juanje
juanje / Description.md
Last active November 30, 2023 19:29
Limit Chrome from eating all the memory and CPU

I was tired of Chrome eating all my laptop resources so I decided to put some limit to it with cgroup.

As I was using Ubuntu 12.04 with support for cgroup, I installed the package cgroup-bin and add the following group to the file /etc/cgconfig.conf:

group browsers {
    cpu {
#       Set the relative share of CPU resources equal to 25%
        cpu.shares = "256";
 }