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 / 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)