Skip to content

Instantly share code, notes, and snippets.

View gwsu2008's full-sized avatar

Guang gwsu2008

View GitHub Profile
@gwsu2008
gwsu2008 / centos7-python35.sh
Last active November 23, 2017 16:06
centos7-python35.sh
#!/bin/bash -x
sudo yum -y install yum-utils
sudo yum -y install https://centos7.iuscommunity.org/ius-release.rpm
sudo yum -y install python35u
sudo yum -y install python35u-pip
sudo yum -y install python35u-devel
sudo yum -y install python35u-tools
sudo yum -y install openssl-devel
@gwsu2008
gwsu2008 / get-html.js
Created October 6, 2017 19:43
get-html.js
var request = require('request');
request('https://0n2i23kb6f.execute-api.us-east-1.amazonaws.com/dev/mydemoresource', function (error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body) // Show the HTML
}
})
@gwsu2008
gwsu2008 / git-cmd.sh
Last active November 3, 2021 15:56
Useful git command
#!/bin/bash +x
git archive --format=tar --remote=ssh://git@bitbucket.io:7999/test/tools.git HEAD:cloud_gen | gzip >tools-1.4.0.tar.gz
git archive --format=tar --remote=ssh://git@bitbucket.io:7999/test/mobile-app.git --prefix=scripts/ HEAD:mobile-app/Scripts/Build-Phases | gzip >test.gz
# lets you add currently staged changes to your last commit.
# Exclude the --no-edit option and Git will prompt if you wish to change commit message.
# This command comes in very handy for those cases when you find out that you need to
# make a little change after you’ve already committed your changes.
git commit --amend --no-edit
@gwsu2008
gwsu2008 / ssh-cmd.sh
Last active July 9, 2018 21:43
Useful ssh commands
#!/bin/bash +x
# ssh tunnel proxy
ssh -i ~/.ssh/int.pem -o 'ProxyCommand=ssh -i ~/.ssh/ci.pem centos@10.150.1.1 -W %h:%p 2>/dev/null' hadoop@10.1.0.1
ssh -o ProxyCommand='ssh -q -W %h:%p -i ~/.ssh/jumpbox-dev.pem ec2-user@jumpbox-host' -i ~/.ssh/emr-proteus-dev.pem hadoop@destination_host
@gwsu2008
gwsu2008 / redis-cmd.sh
Created October 11, 2017 04:53
redis-commands
#!/bin/bash +x
/usr/local/bin/redis-cli flushall
/usr/local/bin/redis-cli bgsave
/usr/local/bin/redis-cli KEYS \*
/usr/local/bin/redis-cli SHUTDOWN SAVE
/usr/local/bin/redis-cli KEYS \* > /tmp/redis-queue.log
/usr/local/bin/redis-cli flushall
./redis-cli bgsave
/usr/local/bin/redis-cli KEYS \*
@gwsu2008
gwsu2008 / aws-cmd.sh
Last active May 5, 2018 00:03
AWS useful commands.
perl cfsign.pl --action encode --url <URL> --expires 1475882487 --private-key private-key --key-pair-id AWS_ACCESS_KEY
aws --profile xyz s3 cp my.json s3://xyz/releases/my.json --metadata-directive REPLACE --cache-control max-age=0,no-cache,no-store,must-revalidate --content-type application/json --acl public-read
@gwsu2008
gwsu2008 / jenkins-ping-thread-config
Last active July 28, 2020 12:55
Jenkins Ping Thread
-Dhudson.remoting.Launcher.pingTimeoutSec=240
-Dhudson.remoting.Launcher.pingIntervalSec=0 (slave)
-Dhudson.slaves.ChannelPinger.pingIntervalSeconds=0 (master)
@gwsu2008
gwsu2008 / lambda-basic-auth.js
Created November 22, 2017 17:50 — forked from lmakarov/lambda-basic-auth.js
Basic HTTP Authentication for CloudFront with Lambda@Edge
'use strict';
exports.handler = (event, context, callback) => {
// Get request and request headers
const request = event.Records[0].cf.request;
const headers = request.headers;
// Configure authentication
const authUser = 'user';
const authPass = 'pass';
@gwsu2008
gwsu2008 / linux-chmod-usage
Last active December 10, 2017 01:28
chmod-usage
format <user,group,other>
7 read, write and execute 111
6 read and write 110
5 read and execute 101
4 read only 100
3 write and execute 011
2 write only 010
1 execute only 001
0 none 000
@gwsu2008
gwsu2008 / java-string-match.java
Created December 10, 2017 06:22
java string match
import java.util.*;
import java.util.regex.*;
class NumRegex
{
public static void main(String args[])
{
// Create a regular expression that matches
// any number You know all this! This is why you came here ;)
// What matches and what doesn't?
// 1 matches