Skip to content

Instantly share code, notes, and snippets.

View ip413's full-sized avatar
🇵🇱

ip413 ip413

🇵🇱
View GitHub Profile
@ip413
ip413 / nvmlink
Created May 13, 2024 10:31 — forked from MeLlamoPablo/nvmlink
Creates a symlink to /usr/bin/node after using nvm
#!/usr/bin/sh
journalctl -r -S "1 day ago" | grep "System returned from sleep state" | head -1 | awk '{print $1, $2, $3}' | {read last_wake_up; echo $(($(date --date="now" +%s) - $(date --date="$last_wake_up" +%s)))} | {read sec ; eval "echo $(date -ud "@$sec" +'$((%s/3600/24)) days %H hours %M minutes %S seconds')"}
#!/usr/bin/bash
# change modify date of file to date from exif properties (DateTimeOriginal)
for file in *; do touch -t `exiftool -s -s -s -d "%Y%m%d%H%M.%S" -DateTimeOriginal $file` $file; done
@ip413
ip413 / Wayland.md
Created March 29, 2022 06:39 — forked from probonopd/Wayland.md
Boycott Wayland. It breaks everything!

Think twice before abandoning Xorg. Wayland breaks everything!

tl;dr: Wayland is not ready as a 1:1 compatible Xorg replacement just yet, and maybe never will. Hence, if you are interested in existing applications to "just work" without the need for adjustments, then you may be better of not using Wayland at this point.

Wayland solves no issues I have but breaks almost everything I need. And usually it stays broken, because the Wayland folks only seem to care about Gnome, and alienating everyone else in the process. DO NOT INSTALL WAYLAND! Let Wayland not destroy everything and then have other people fix the damage it caused. Or force more Red Hat/Gnome components (glib, Portals, Pipewire) on everyone!

Please add more examples to the list.

Wayland breaks screen recording applications

#!/bin/sh
# Imagemagick analogue of Adobe Photoshop Gradient map with 75% opacity on it
# you will need the input.jpg file with original color image
# and gradient_line.png file with 256 x 1 px image of gradient
# make image grayscale
convert input.jpg -colorspace gray draft.jpg
# apply the gradient lut
#!/bin/bash
# usage-message.sh
if [ $# -eq 0 ]; then
printf "No arguments provided!\n\n"
cat <<EOF
Script accepts three arguments:
- set of characters to generate (more: man tr) (* required)
- number of charaters to generate (* required)
- length of one line (optional, default: value of second argument)
@ip413
ip413 / read_arguments.js
Last active May 29, 2021 17:13 — forked from ishu3101/read_arguments.js
Accept input via stdin and arguments in a command line application in node.js
#!/usr/bin/env node
main();
function main() {
const usageMsg = 'Usage: ...\n';
// If no STDIN and no arguments
if (process.stdin.isTTY && process.argv.length <= 2) {
process.stderr.write(usageMsg);
@ip413
ip413 / oregon.zsh-theme
Last active May 20, 2021 07:40
zsh theme
# there is some idea behind it:
# - line with command should be short as possible
# - line with command should be more visibile than first (metadata) line
# - there should be time with seconds, just because
PROMPT=$' \e[90m%n@%m %D{[%H:%M:%S]} [%~]%{$reset_color%} $(git_prompt_info)\
%(?:%{$bg[green]%}###:%{$bg[red]%}###)%{$reset_color%} '
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}["
ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%}"
@ip413
ip413 / oneliners.js
Created February 23, 2021 10:23 — forked from ghostcode/oneliners.js
👑 Awesome one-liners you might find useful while coding.
// By @coderitual
// https://twitter.com/coderitual/status/1112297299307384833
// Remove any duplicates from an array of primitives.
const unique = [...new Set(arr)]
// Sleep in async functions. Use: await sleep(2000).
const sleep = (ms) => (new Promise(resolve => setTimeout(resolve, ms)));
// Type this in your code to break chrome debugger in that line.
@ip413
ip413 / attractors.py
Created February 20, 2021 22:03 — forked from ylegall/attractors.py
code for animating strange attractors in blender
import bpy
import bmesh
import random
from mathutils import Vector, noise, Matrix
from math import sin, cos, tau, pi, radians
from utils.interpolation import *
from easing_functions import *
frame_start = 1
total_frames = 120