Skip to content

Instantly share code, notes, and snippets.

Julien Barbot klyr

Block or report user

Report or block klyr

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:a0be480709959129fa67ca20fe2532dd
pacmd list-sinks | grep name:
pacmd load-module module-remap-sink sink_name=mono master=<name_of_audio sink_given_by_previous_command> channels=2 channel_map=mono,mono
speaker-test -c 2 -t sine
@klyr
klyr / Makefile
Created May 6, 2019
Makefile for blockdiag
View Makefile
SOURCEDIR = diags
BUILDDIR = png
BLOCKDIAG_SOURCES = $(wildcard $(SOURCEDIR)/*.blockdiag)
SEQDIAG_SOURCES = $(wildcard $(SOURCEDIR)/*.seqdiag)
ACTDIAG_SOURCES = $(wildcard $(SOURCEDIR)/*.actdiag)
NWDIAG_SOURCES = $(wildcard $(SOURCEDIR)/*.nwdiag)
BLOCKDIAG_GENERATED = $(patsubst $(SOURCEDIR)/%.blockdiag, $(BUILDDIR)/%.png, $(BLOCKDIAG_SOURCES))
SEQDIAG_GENERATED = $(patsubst $(SOURCEDIR)/%.seqdiag, $(BUILDDIR)/%.png, $(SEQDIAG_SOURCES))
@klyr
klyr / ps1
Created Apr 15, 2019
VMware script executed by vmware tools
View ps1
$vmlog = 'C:\Program Files\vmlogs\vmenv.log'
$getenv = "C:\Program Files\VMware\VMware Tools\vmtoolsd.exe" --cmd="info-get guestinfo.ovfEnv" > "C:\Program Files\vmlogs\vmenv.xml"
Invoke-Expression -Command $getenv
[xml]$vmenv = Get-Content $vmenvxml
$vmIP = $vmenv.Environment.PropertySection.Property | ?{ $_.key -like 'ip_address' } | select -expand value
$vmNetmask = $vmenv.Environment.PropertySection.Property | ?{ $_.key -like 'netmask' } | select -expand value
$vmGW = $vmenv.Environment.PropertySection.Property | ?{ $_.key -like 'default_ateway' } | select -expand value
View Dockerfile
# ============LICENSE_START=======================================================
# org.onap.dcae
# ================================================================================
# Copyright (c) 2018 Cisco Systems. All rights reserved.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
View gist:12f41dda5f39cbb5eefe409d3f7d35b4
https://stedolan.github.io/jq/manual/
https://stedolan.github.io/jq/tutorial/
http://hyperpolyglot.org/json
http://andrew.gibiansky.com/blog/command-line/jq-primer/
http://arjanvandergaag.nl/blog/wrestling-json-with-jq.html
http://programminghistorian.org/lessons/json-and-jq
http://kamicut.cc/2014/11/19/using-jq-nested-objects.html
@klyr
klyr / tcpdump.sh
Last active May 1, 2017
tcpdump useful commands
View tcpdump.sh
# From Vincent Bernat
# (-s0 not useful, just an habit)
ssh http://some.remote.host tcpdump -pni eth0 -s0 -w - -U port 8888 | wireshark -k -i -
@klyr
klyr / add-yum-repo-salt.sh
Last active Mar 20, 2017
Add epel repo with saltstack
View add-yum-repo-salt.sh
sudo salt '*' pkg.mod_repo base enabled=1 name='CentOS-$releasever - Base' mirrorlist='http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os' gpgcheck=1
sudo salt '*' pkg.mod_repo update enabled=1 name='CentOS-$releasever - Updates' mirrorlist='http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates' gpgcheck=1
sudo salt '*' pkg.mod_repo epel enabled=1 name='Extra Packages for Enterprise Linux 7 - $basearch' mirrorlist='https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch' gpgcheck=1
sudo salt '*' pkg.mod_repo epel-testing enabled=1 name='Extra Packages for Enterprise Linux 7 - Testing - $basearch' mirrorlist='https://mirrors.fedoraproject.org/metalink?repo=testing-epel7&arch=$basearch' gpgcheck=1
@klyr
klyr / create-vm-cloud-init.sh
Created Mar 10, 2017
Boot a qcow cloud-init image with kvm
View create-vm-cloud-init.sh
img_url="http://cloud-images.ubuntu.com/releases/xenial/release"
img_url="${img_url}/ubuntu-16.04-server-cloudimg-amd64-disk1.img"
wget $img_url -O disk.img.dist
cat > my-user-data <<EOF
#cloud-config
password: changeme
chpasswd: { expire: False }
ssh_pwauth: True
View gist:3f09e55183d9f287d6fe6f8076a4ccc3

Signing someone else key

Get key to sign

gpg --list-keys

Sign the key

gpg --sign-key --ask-cert-level 0xXXXXXXXXX
@klyr
klyr / pnda-compact.sh
Created Jan 11, 2017
Compact multiple PNDA avro files into one
View pnda-compact.sh
set -e
for d in $(hdfs dfs -ls -R '/user/pnda/PNDA_datasets/datasets/source=*'|awk '/^d.*hour=..$/ {printf "%s ", $NF}'); do
IN=$(hdfs dfs -ls ${d}/*.avro | awk '{printf "%s ", $NF}')
OUT=${d}/compacted.avro.new
echo "--- In '$d' Compacting files '${IN}' to '${OUT}'"
hadoop jar /opt/cloudera/parcels/CDH/lib/avro/avro-tools.jar concat ${IN} ${OUT}
hdfs dfs -chown gobblin:pnda ${OUT}
hdfs dfs -rm -skipTrash ${d}/*.avro
hdfs dfs -mv ${OUT} ${d}/compacted.avro
You can’t perform that action at this time.