Skip to content

Instantly share code, notes, and snippets.

@chtz
chtz / install-mitmproxy.sh
Created March 16, 2016 10:20
Install mitmproxy
sudo -H pip install mitmproxy --update
@chtz
chtz / log-to-sql-ruby-filter-sample.rb
Created March 16, 2016 10:26
Convert log to sql (ruby unix-style filter sample)
while line = gets
if line =~ /.*externalId\=(.*)\, id=(.*)/
puts "update fnmig.cormig set currentdocumentid='#{$2}', status='manual-delete' where externalid='#{$1}';"
end
end
#!/usr/bin/ruby
#$ time java -Xms2000m -Xmx2000m -jar jruby-complete-1.7.24.jar diff.complex.rb 1_to_40000000.csv 1_to_3000000.x.csv
#000000000000000000000000000000000000000011111111111111111111111111111100000000000000000000000000000000000000001111111111111111111111111111110000000000000000000000000000000000000000111111111111111111111111111111000000000000000000000000000000000000000011111111111111111111111111111100000000000000000000#000000000000000000001111111111111111111111111111110000000000000000000000000000000000000000111111111111111111111111111111000000000000000000000000000000000000000011111111111111111111111111111100000000000000000000000000000000000000001111111111111111111111111111110000000000000000000000000000000000000000#1111111111111111111111111111110000000000000000000000000000000000000000111111111111111111111111111111
#s0.length = 40000000
#s1.length = 3000001
#s1 in s0 = 3000000
#s1 NOT in s0 = 1
#1111111111111111111111111111112222222222222222222222222222223333333333333333333333333333334444444444444
@chtz
chtz / gist:b3f3e0e764a75ee4f41e0e7da922c39d
Created July 4, 2017 21:09
SSH over HTTP tunnel (hts- & htc Sample)
# Client (Cygwin)
lynx -source rawgit.com/transcode-open/apt-cyg/master/apt-cyg > apt-cyg
install apt-cyg /bin
apt-cyg install httptunnel
htc -P $CORP_HTTP_PROXY_HOST:$CORP_HTTP_PROXY_PORT -F 8888 $HTS_SERVER_HOST:80
 
ssh -p 8888 $USER@localhost
require 'nokogiri'
def open_pom
File.open("pom.xml") { |f| Nokogiri::XML(f) }
end
def save_pom(pom)
File.open('pom.xml','w') {|f| pom.write_xml_to f}
end
require 'nokogiri'
def open_pom
File.open("pom.xml") { |f| Nokogiri::XML(f) }
end
def save_pom(pom)
File.open('pom.xml','w') {|f| pom.write_xml_to f}
end
@chtz
chtz / artifactory-deploy-curl-sample.sh
Created March 11, 2018 20:28
Deploy jar to artifactory with curl
docker run -d --name artifactory-oss -p 8081:8081 docker.bintray.io/jfrog/artifactory-oss:4.16.0
curl -uadmin:password -T target/backup-0.0.2.jar "http://localhost:8081/artifactory/libs-release-local/ch/furthermore/backup/0.0.2/backup-0.0.2.jar"
curl -uadmin:password -T pom.xml "http://localhost:8081/artifactory/libs-release-local/ch/furthermore/backup/0.0.2/backup-0.0.2.pom"
@chtz
chtz / artifactory_deploy.rb
Created March 11, 2018 21:21
Artifactory (4.16.0 / default admin) deployment sample in ruby (no error handling)
require 'nokogiri'
require 'net/http'
ARTIFACTORY_URL = "http://localhost:8081/artifactory/libs-release-local"
ARTIFACTORY_USER = "admin"
ARTIFACTORY_PASS = "password"
TARGET_FOLDER = "target"
def open_pom
@chtz
chtz / install-cloudwatch-log-agent-amazonlinux2.sh
Created May 22, 2019 21:07
Install AWS CloudWatch log agent on Amazon Linux 2
#!/bin/bash
# Pre cond:
#
# EC2 IAM role with this IAM policy:
# {
# "Version": "2012-10-17",
# "Statement": [
# {
# "Effect": "Allow",
@chtz
chtz / fritz-dyndns-url-template.txt
Created May 11, 2020 07:06
Fritz.box custom DynDNS URL
https://<host>/<path>?i=<ipaddr>&l=<username>&p=<pass>&h=<domain>