Skip to content

Instantly share code, notes, and snippets.

Petri Sirkkala sirkkalap

Block or report user

Report or block sirkkalap

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
@sirkkalap
sirkkalap / curl_list_of_urls.sh
Created Jun 3, 2019
Curl a list of urls in a loop
View curl_list_of_urls.sh
while read u; do
echo $u
curl -I $u
done << EOM
https://www.iki.fi/
http://www.iki.fi/iki/iki-logo-16.gif
EOM
@sirkkalap
sirkkalap / EditCachetIncidentMsg.java
Created Jul 10, 2017
A snippet to demonstrate editing Cachet Incident message text.
View EditCachetIncidentMsg.java
...
package fi.XXX.digitraffic.status.dto.cachet;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
@JsonIgnoreProperties(ignoreUnknown = true)
public class IncidentEditMsgDto {
public final Integer incident;
View Install the latest tmux (2.2 now) on CentOS 6.7
## you may need sudo permission to execute some commands or swith to root
# if installed old version by yum, remove it first
yum -y remove tmux libevent libevent-devel libevent-headers
# install deps
yum -y install gcc kernel-devel make ncurses-devel wget
# create temp dir
mkdir /tmp/for-latest-tmux
@sirkkalap
sirkkalap / .inputrc
Created May 11, 2017
.inputrc with history search
View .inputrc
### .inputrc
## arrow up
"\e[A":history-search-backward
## arrow down
"\e[B":history-search-forward
View gist:86341d6a3c4ccfe258c96b3040991302
#!/bin/sh -e
# Running this script will disable the on-access (real-time) scanner in F-Secure Anti-Virus for Mac
# while preserving the ability to use the on-demand (manual) scanner.
#
# Note that this *will* make the UI persistently tell you that there is a problem with real-time
# scanning. Which is true, because you disabled it. :-)
#
# NOTE THAT THIS WILL MAKE YOUR COMPUTER UNPROTECTED. DO THIS AT YOUR OWN RISK!
# NOTE THAT THIS WILL MAKE A BACKUP COPY IN YOUR "Documents" FOLDER. KEEP IT.
# NOTE THAT THIS IS AN UNSUPPORTED HACK. IT MAY STOP WORKING AT ANY TIME.
@sirkkalap
sirkkalap / InstallProxyTunnelUbuntu.sh
Last active Aug 18, 2016
This installs dependencies, checks out the Proxytunnel and builds it on Ubuntu.
View InstallProxyTunnelUbuntu.sh
# Use
# curl -sSL https://gist.githubusercontent.com/sirkkalap/3c11f952fea778110cfdb73ec3b97d8b/raw/InstallProxyTunnelUbuntu.sh | bash -x
sudo apt-get -y install libssl-dev
git clone https://github.com/sirkkalap/proxytunnel.git
cd proxytunnel
make proxytunnel
View git-lg.sh
#!/bin/sh
# curl -sSL https://gist.githubusercontent.com/sirkkalap/f31998c57cc0c3b5fbd5b0b0ee7bbca2/raw/3665a4962caba46b2729e4b5b835503c98734ae2/git-lg.sh | sh -
git config --global alias.lg \
"log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative"
@sirkkalap
sirkkalap / brew_update_upgrade.sh
Created Mar 17, 2016
Keep up to date with Homebrew
View brew_update_upgrade.sh
#!/bin/sh
BASEDIR=$(cd $(dirname $0); /bin/pwd)
($BASEDIR/isodate && /usr/local/bin/brew update && /usr/local/bin/brew upgrade --all) >>$HOME/brew-update.log 2>&
@sirkkalap
sirkkalap / test-dns.sh
Last active Mar 16, 2016
Sometimes DNS answers change unexpectedly. This shell script will try to log DNS answers. You may change the DNS-server IP addresses on lines 4 and 5.
View test-dns.sh
#!/bin/bash
while true; do
echo $(date +%FT%T%z) $(dig +noall +answer +stats ftp.example.com | tr '\n' ' ')
echo $(date +%FT%T%z) $(nslookup ftp.example.com 10.1.2.3 | tr '\n' ' ')
echo $(date +%FT%T%z) $(nslookup ftp.example.com 10.2.4.6 | tr '\n' ' ')
sleep 60
done
#[sirkkalap@mymachine ~]$ nohup ./test_dns.sh &
#[1] 16406
#[sirkkalap@mymachine ~]$ tail nohup.out
@sirkkalap
sirkkalap / curl-times.sh
Last active Mar 11, 2016
Take response times of a site at given interval
View curl-times.sh
#!/bin/bash
# Adopted from https://josephscott.org/archives/2011/10/timing-details-with-curl/
#
url=${1:?usage "[nohup] curl-times.sh <url> [ <sleep=1> ]"}
sleep=${2:-1}
format=" time_namelookup: %{time_namelookup} time_connect: %{time_connect}, time_appconnect: %{time_appconnect}, time_pretransfer: %{time_pretransfer}, time_redirect: %{time_redirect}, time_starttransfer: %{time_starttransfer}, time_total: %{time_total}\n"
while true; do
echo -n $(date +%FT%T%z)
curl -w "${format}" -o /dev/null -s "$url"
You can’t perform that action at this time.