Skip to content

Instantly share code, notes, and snippets.

@LukasRypl
LukasRypl / remove_all_mac_meta_files.sh
Created July 10, 2022 21:03
After connecting card/USB storage to mac, lot of extra hidden files are generated ... this is a way to remove them
#!/bin/bash
volume="/Volumes/CANON_DC"
# disable indexing
sudo mdutil -v -i off ${volume}
# remove index
sudo mdutil -v -X ${volume}
function sshi --description 'new ssh peer' --argument ip
if test -n "$ip"
set v6can (ipv6calc -q $ip)
echo removing IP $ip and $v6can from known_hosts and sending my keys
set_color green
and ssh-keygen -R $ip
and ssh-keygen -R $v6can
and set_color normal
and ssh-copy-id root@$ip
else
@LukasRypl
LukasRypl / update
Created September 4, 2017 08:19
update script (mac)
function update-all
brew update
brew upgrade
gem update
omf update
end
Final goal: http://breaking-the-system.blogspot.cz/2014/08/emulating-usb-devices-in-python-with-no.html
Newer version: https://github.com/lcgamboa/USBIP-Virtual-USB-Device
------
server:
# lsb_release -a
LSB Version: core-2.0-noarch:core-3.2-noarch:core-4.0-noarch:core-2.0-x86_64:core-3.2-x86_64:core-4.0-x86_64:desktop-4.0-amd64:desktop-4.0-noarch:graphics-2.0-amd64:graphics-2.0-noarch:graphics-3.2-amd64:graphics-3.2-noarch:graphics-4.0-amd64:graphics-4.0-noarch
Distributor ID: openSUSE Leap
@LukasRypl
LukasRypl / mvncolor.sh
Created December 19, 2016 11:08 — forked from katta/mvncolor.sh
Script to add colors to maven output
#!/usr/bin/env bash
# Formatting constants
export BOLD=`tput bold`
export UNDERLINE_ON=`tput smul`
export UNDERLINE_OFF=`tput rmul`
export TEXT_BLACK=`tput setaf 0`
export TEXT_RED=`tput setaf 1`
export TEXT_GREEN=`tput setaf 2`
export TEXT_YELLOW=`tput setaf 3`
@LukasRypl
LukasRypl / setBandwidthAndDelay.sh
Last active November 21, 2017 08:58
Linux TC
#!/bin/bash
#
###############################################################################
# Script used for setting bandwidth and delay. #
###############################################################################
#
# bandwidth in kilobytes
BANDWIDTH="640"
# time to reach other server (RTT will be 2xlonger=40ms)
@LukasRypl
LukasRypl / logging and tracing.sh
Created October 25, 2016 15:58
Log and debug -- without XDEBUGFD so it works with bash version <4.1
#!/bin/bash -eu
tag=$(dirname $(readlink -f $0))/$(basename $0)
# redirects output to logger, -s print it to stderr as well, -t add script name as a tag
# http://stackoverflow.com/questions/3173131/redirect-copy-of-stdout-to-log-file-from-within-bash-script-itself
exec > >( logger -s -t "${tag} [INFO ]" )
# trap handler: print last error - filename, line, return code to stderr
function error-trap-handler()
{
@LukasRypl
LukasRypl / AudioSystemInfo.java
Created October 18, 2016 13:50
Audio devices as seen by javax.sound
import javax.sound.sampled.*;
import java.util.Arrays;
public class AudioSystemInfo {
public static void main(String[] args) {
System.out.println("Audio devices as seen by javax.sound:");
// simpleMixerInfo();