Skip to content

Instantly share code, notes, and snippets.

@sebva
sebva / tlsping.sh
Created December 3, 2018 11:20
TLS ping script
#!/bin/sh
echo QUIT | busybox timeout -t 1 openssl s_client -brief -connect "$1"
@sebva
sebva / commands.sh
Created September 5, 2018 08:50
Moving a directory from one repo to another
git clone <repourl>/repo-1.git
git clone <repourl>/repo-2.git
# Start in the source repo
cd repo-1
git remote rm origin # delete link to original repository to avoid any accidental remote changes
git filter-branch --subdirectory-filter dir-to-move -- --all # dir-to-move is being moved to another repo. This command goes through history and files, removing anything that is not in the folder. The content of this folder will be moved to root of the repo as a result.
# This folder has to be moved to another folder in the target repo. So, move everything to another folder.
git filter-branch --index-filter \
'git ls-files -s | sed "s-\t\"*-&NEWSUBDIR/-" |
diff --git a/psw/uae_service/linux/Makefile b/psw/uae_service/linux/Makefile
index c33d8679..b7c7286d 100644
--- a/psw/uae_service/linux/Makefile
+++ b/psw/uae_service/linux/Makefile
@@ -57,7 +57,7 @@ INCLUDE += -I$(LINUX_EXTERNAL_DIR)/epid \
-I$(IPC_COMMON_PROTO_DIR) \
-I$(LINUX_PSW_DIR)/ae/aesm_service/source
-CXXFLAGS += -fPIC -Werror -g -DPROTOBUF_INLINE_NOT_IN_HEADERS=0
+CXXFLAGS += -fPIC -Werror -Wno-unused -g -DPROTOBUF_INLINE_NOT_IN_HEADERS=0
@sebva
sebva / install-sgx-2.0.sh
Last active January 8, 2018 15:51
Unattended install of Intel SGX Driver/SDK/PSW 2.0 for Ubuntu 16.04
#!/bin/bash
sudo apt-get update && sudo apt-get install -yq --no-install-recommends ca-certificates build-essential ocaml automake autoconf libtool wget python libssl-dev libcurl4-openssl-dev protobuf-compiler libprotobuf-dev alien cmake uuid-dev libxml2-dev pkg-config
wget -O - https://github.com/01org/linux-sgx-driver/archive/sgx_driver_2.0.tar.gz | tar -xz && \
cd linux-sgx-driver-sgx_driver_2.0 && \
make && \
sudo make install && \
sudo depmod && \
sudo modprobe isgx
@sebva
sebva / dock.sh
Created May 10, 2017 07:19
Switch to DVI monitor on dock with scaling of 1, or to laptop integrated monitor with scaling of 1.6 on GNOME
#!/bin/sh
gsettings set org.gnome.settings-daemon.plugins.xsettings overrides "{'Gdk/WindowScalingFactor': <1>}"
gsettings set org.gnome.desktop.interface scaling-factor 1
xrandr --output eDP1 --off --output DP2-2 --auto
@sebva
sebva / renew_ilo.sh
Created February 23, 2016 18:46
Renew/assign a Let's Encrypt certificate on an HP iLO 4 system
#!/bin/zsh
# Needs https://github.com/lukas2511/letsencrypt.sh in dns-01 mode
/opt/letsencrypt/ilo/letsencrypt.sh -c -s /opt/letsencrypt/ilo/ilo.csr -k /opt/letsencrypt/ilo/hook.sh -t dns-01 > /opt/letsencrypt/ilo/ilo.crt
cert=$(cat /opt/letsencrypt/ilo/ilo.crt)
curl --cacert /opt/letsencrypt/intermediate.pem -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Basic [FILL_IN_HERE]" -X POST -d "{\"Action\": \"ImportCertificate\", \"Certificate\": \"$cert\"}" https://ilo.home.vaucher.org/rest/v1/Managers/1/SecurityService/HttpsCert
@sebva
sebva / backup_script.pl
Last active January 12, 2016 17:52
Backup script using rsnapshot for Thecus N5550
#!/raid/module/Perl514/system/bin/perl -w
# Call this script weekly on Sunday from crontab
use strict;
use warnings;
use DateTime;
my $root = '/raid/rsnapshot';
#my $rsnap = "/bin/echo";
my $rsnap = "$root/rsnapshot";
@sebva
sebva / .zshrc
Last active November 7, 2017 12:31
zshrc
DEFAULT_USER=sebastien
source /usr/share/zsh-antigen/antigen.zsh
# Load the oh-my-zsh's library.
antigen use oh-my-zsh
# Bundles from the default repo (robbyrussell's oh-my-zsh).
antigen bundle git
antigen bundle adb