Skip to content

Instantly share code, notes, and snippets.

View morfikov's full-sized avatar

Mikhail Morfikov morfikov

View GitHub Profile
@morfikov
morfikov / generate-silence.sh
Created December 8, 2021 22:45 — forked from daz/generate-silence.sh
Generate a silent AAC audio with ffmpeg
ffmpeg -f lavfi -i anullsrc=r=11025:cl=mono -t <number of seconds> -acodec aac out.m4a
@morfikov
morfikov / a_enable_wireless.sh
Last active February 26, 2024 01:49 — forked from telenieko/a_enable_wireless.sh
Sample files to enable wireless on Debian initramfs
#!/bin/sh
# this goes into /etc/initramfs-tools/scripts/init-premount/a_enable_wireless
PREREQ=""
prereqs()
{
echo "$PREREQ"
}
case $1 in
prereqs)
@morfikov
morfikov / brightnessControl.sh
Created July 30, 2021 15:16 — forked from rjl6789/brightnessControl.sh
Notifications for brightness and volume, using dunstify
#!/usr/bin/env bash
# You can call this script like this:
# $ ./brightnessControl.sh up
# $ ./brightnessControl.sh down
# Script inspired by these wonderful people:
# https://github.com/dastorm/volume-notification-dunst/blob/master/volume.sh
# https://gist.github.com/sebastiencs/5d7227f388d93374cebdf72e783fbd6a
@morfikov
morfikov / C-states.md
Created December 6, 2018 11:33 — forked from wmealing/C-states.md
What are CPU "C-states" and how to disable them if needed?

To limit a CPU to a certain C-state, you can pass the processor.max_cstate=X option in the kernel line of /boot/grub/grub.conf.

Here we limit the system to only C-State 1:

    kernel /vmlinuz-2.6.18-371.1.2.el5 ... processor.max_cstate=1

On some systems, the kernel can override the BIOS setting, and the parameter intel_idle.max_cstate=0 may be required to ensure sleep states are not entered:

@morfikov
morfikov / sed cheatsheet
Created May 15, 2018 06:45 — forked from un33k/sed cheatsheet
magic of sed -- find and replace "text" in a string or a file
FILE SPACING:
# double space a file
sed G
# double space a file which already has blank lines in it. Output file
# should contain no more than one blank line between lines of text.
sed '/^$/d;G'

These are only examples, for a few very common actions. You are expected to write your own rules for the rest. The syntax is regular JavaScript, but see the polkit(8) manpage for the object structure and available API. These examples are for polkit versions 106 and later, with the JS interpreter. They won't work with Debian's polkit v105.

  • If you don't know the action name, run pkaction:

    pkaction | grep cups
    
  • The possible results are YES, AUTH_SELF(_KEEP), AUTH_ADMIN(_KEEP), NO. Returning a result is final. Returning null will continue checking other rules.

  • Put your rules in /etc/polkit-1/rules.d/*.rules. (You can check everything in one giant addRule, or you can have a separate file and separate addRule for each program; it doesn't matter.)

@morfikov
morfikov / android_phone_as_a_LUKS_token.md
Last active May 20, 2024 21:35
How to use your Android phone as a key to your encrypted linux desktop/laptop system (LUKS/LUKS2 based)

About this HowTo

Encrypted systems (desktops/laptops) have one major problem when it comes to providing security over protected files. When you sit in front of your machine, you can feel safe because no one can break into the system without your knowledge. Moreover, if they try to do some bad actions, you can detect them and avoid the imminent danger. But what if you leave your laptop alone? Even if you think that you can lock it, turn it off or hibernate it, the machine still isn't secure as you would have thought. The problem lays in the physical access that people can get when you're not around and hence set some traps for you when you're not looking. To avoid the danger that comes

@morfikov
morfikov / compile-kernel-G4c
Created March 6, 2018 21:37 — forked from vinecodes/compile-kernel-G4c
Kernel Compilation Guide for LG G4c
Kernel Compilation Guide
Author: Vineeth Penugonda
(1) git clone https://github.com/LG-K10/android_kernel_lge_msm8916.git -b cm-14.1
(2) git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8
(3) sudo gedit ~/.profile.
Then, source ~/.profile.
(4) (Add below lines at the end)
@morfikov
morfikov / LG_G4C_new_flash_layout.md
Last active April 24, 2018 14:26
How to change the default flash layout of the LG G4C phone in oder to make more space for user data

The purpose of this HOWTO

This HOWTO is for people who have a LG G4C phone (H525N) and don't really like the flash layout that comes with it. Basically this phone has a /system/ partition that is 2.4 GiB in size and a /cache/ partition that is 850.0 MiB in size, which is a waste of space when you deal with custom ROMs. Also you have only 3.6 GiB for user data. What I want to do is to repartition the phone's flash and add around 2 GiB to the user data partition making it a little bit larger ~5,7 GiB. It will be done by taking ~1,5 GiB from the /system partition/ and ~600MiB from the /cache/ partition. All of the steps will be done in the TWRP recovery, so you have to flash it before (here