Skip to content

Instantly share code, notes, and snippets.

View szkrd's full-sized avatar

szabi szkrd

  • tralfamadore
View GitHub Profile
!dpi should be 125.37, but thats just huge
!the rest has been taken from the arch forum
xft.dpi: 110
xft.antialias: true
xft.rgba: rgb
xft.hinting: true
xft.hintstyle: hintslight
!xterm settings, mostly taken from the arch wiki
xterm*reverseVideo: on
@szkrd
szkrd / create_pcsettings_links.js
Last active August 11, 2018 18:06
Creates opener links for all the PC Settings in Windows 10, so a file indexer can pick them up without an effort.
@szkrd
szkrd / createBem.ts
Created August 30, 2018 08:30
quick bem helper hack
import * as log from 'loglevel'
// # create bem
//
// ```
// const bem = createBem('my-favorite-foods')
//
// bem.b() === 'my-favorite-foods'
// bem.b('ordered') === 'my-favorite-foods--ordered'
// bem.b(['ordered', 'waiting-for']) === 'my-favorite-foods--ordered my-favorite-foods--waiting-for'
@szkrd
szkrd / prettifyChanged.js
Last active April 11, 2019 13:48
prettify changed ts(x) files
const fs = require('fs')
const path = require('path')
const shell = require('shelljs')
const prettier = require('prettier')
const args = process.argv
const doGitAdd = args.includes('--git-add') || args.includes('-ga')
const FILTER_PATTERN = /\.tsx?$/
shell.config.silent = true
const changedFiles = shell.exec('git status --porcelain=v1 -z')
@szkrd
szkrd / autoConnect.ts
Last active July 19, 2020 09:48
react redux typescript fancy connect (with IDE code completion)
import store, { IState } from '../../actions'
import { connect } from 'react-redux'
const isFunc = (item) => typeof item === 'function'
const isNotFunc = (item) => !isFunc(item)
const filter = (obj, comp) => {
return Object.keys(obj).reduce((acc, key) => {
if (comp(obj[key])) {
acc[key] = obj[key]
}
@szkrd
szkrd / bandcamp-pls.js
Last active July 30, 2019 11:09
save bandcamp album tracks to a pls playlist
// save bandcamp album tracks to a pls playlist;
// mp3 file urls are protected by a token, so these playlist
// will "expire", but at least one can use a native player;
// still, please do read http://bandcamp.com/help/audio_basics#steal
// and http://bandcamp.com/terms_of_use
//
// ```
// mkdir bandcamp-pls && \
// cd bandcamp-pls && \
// npm init --yes && \
@szkrd
szkrd / init-standard.sh
Created July 28, 2019 11:21
node standard seed (standard, eslint, prettier)
#!/usr/bin/env bash
# EDITORCONFIG
# ============
echo "\
root = true
[*]
indent_style = space
@szkrd
szkrd / record-screen.sh
Created February 19, 2020 20:27
record window on x11 using ffmpeg
#!/usr/bin/env bash
NOCOLOR='\e[0m'
RED='\e[0;31m'
GREEN='\e[0;32m'
YELLOW='\e[1;33m'
CYAN='\e[0;36m'
command -v ffmpeg >/dev/null 2>&1 || { echo >&2 "${RED}ffmpeg not installed!${NOCOLOR}"; exit 1; }
echo -e "You can select a window for ${CYAN}fixed coordinates${NOCOLOR} in 3 seconds."
sleep 3
echo "Select window!"
@szkrd
szkrd / checkLocaleJsonValidity.js
Created March 2, 2020 14:30
check if locale json file is valid or not (parsable and has unique jeys only) - since git merge may cause headaches
const fs = require('fs');
const path = require('path');
const dir = path.join(__dirname, '/../locales');
fs.readdir(dir, (err, files) => {
files.filter(fn => /\.json$/.test(fn)).forEach(fn => {
fs.readFile(path.join(dir, fn), (err, s) => {
s = s + '';
let lang = {};
try {
lang = JSON.parse(s);
@szkrd
szkrd / downgrade-all-to-128k-mp3.sh
Created July 4, 2020 19:25
convert all music files recursively to 128k mp3 (and then use cloudbeats or evermusic to stream them)
#!/usr/bin/env bash
read -p "This will RECURSIVELY process all music files and downgrade them; are you sure? " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
[[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1
fi
shopt -s nullglob
# recursively find all music files and then convert them one by one to 128k mp3
find . -type f -iname "*.mp3" -o -iname "*.flac" -o -iname "*.mpc" -o -iname "*.ogg" | while read file; do
cd "$(dirname "${file}")"