Skip to content

Instantly share code, notes, and snippets.

View czocher's full-sized avatar
🦦

Paweł Czochański czocher

🦦
View GitHub Profile
@czocher
czocher / editor.py
Created April 5, 2019 06:40
Contextmanager which opens the default editor on a given text and lets you edit it, then returns the result
import os
import tempfile
from subprocess import call
EDITOR = os.environ.get('EDITOR', 'vi')
class Editor:
def __init__(self, text):
@czocher
czocher / tcp-bbr.txt
Created September 10, 2017 13:27
Makes the internet faster
net.core.default_qdisc = fq
net.ipv4.tcp_congestion_control = bbr
#!/bin/bash
# Install guake and nano
sudo apt-get install -y guake nano
sudo apt-get install -y iptables-persistent
# Download the wallpaper
sudo wget http://i.imgur.com/qIb3xjS.png -O /home/turniej/.wallpaper.jpg
sudo chmod 777 /home/turniej/.wallpaper.jpg
@czocher
czocher / move-mlo.sh
Last active February 1, 2017 18:24
Moving the Beagle Bone Black MLO file
#!/bin/bash
# Mount the eMMC boot partition
cd /media
mkdir boot
mount /dev/mmcblk1p1 ./boot
# Move the MLO file
mv ./boot/MLO ./boot/MLO_backup
@czocher
czocher / write-image-to-sdcard.sh
Created February 1, 2017 18:14
Use fedora-arm-installer to write a Fedora image to a SD card for Beagle Bone Black
#!/bin/bash
sudo fedora-arm-image-installer --target=am335x_boneblack --media=/dev/mmcblk0 --image=Fedora-Minimal-armhfp-25-1.3-sda.raw.xz --selinux=ON --resizefs --addconsole --norootpass
@czocher
czocher / download-fedora-armhf.sh
Last active February 1, 2017 18:03
Script to download and check a Fedora armhf image from the official site
#!/bin/bash
# Download the minimal image
wget -c https://download.fedoraproject.org/pub/fedora/linux/releases/25/Spins/armhfp/images/Fedora-Minimal-armhfp-25-1.3-sda.raw.xz
# Load the Fedora GPG keys
curl https://getfedora.org/static/fedora.gpg | gpg --import
# Load the checksum file
curl -O https://arm.fedoraproject.org/static/checksums/Fedora-Spins-25-1.3-armhfp-CHECKSUM
As root:
fstrim --all
systemctl enable fstrim.timer
Firefox about:config:
browser.sessionstore.interval -> 1800000
browser.cache.disk.enable -> false
browser.cache.memory.capacity -> -1
browser.cache.memory.enable -> true

Keybase proof

I hereby claim:

  • I am czocher on github.
  • I am czocher (https://keybase.io/czocher) on keybase.
  • I have a public key whose fingerprint is C00F 9126 46F8 908A 3E94 44D9 8284 3164 B26A 29FB

To claim this, I am signing this object:

@czocher
czocher / GrayUtils.java
Last active August 29, 2015 14:09
Natural Binary Code to Gray Code and Gray Code to Binary
public class GrayUtils {
public static int binaryToGray(int binary) {
return (binary ^ (binary >>> 1));
}
public static int grayToBinary(int gray) {
int binary = 0;
int i = Integer.parseUnsignedInt("80000000", 16);