This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| SAVEIFS=$IFS | |
| IFS=$(echo -en "\n\b") | |
| for f in $(find . -regex '.*\(webm\|mkv\)$' -print) | |
| do | |
| fn=$(basename "${f}") | |
| extension="${fn##*.}" | |
| f="${fn%.*}" | |
| ffmpeg -i "${fn}" ${f}.mp3 | |
| done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <html> | |
| <head> | |
| <script src="http://www.google.com/jsapi"></script> | |
| <script type="text/javascript"> | |
| // Load jQuery | |
| google.load("jquery", "1.3"); | |
| </script> | |
| <script type="text/javascript"> | |
| function doHide() { | |
| //$("#hint").hide(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <html> | |
| <head> | |
| <script src="http://www.google.com/jsapi"></script> | |
| <script type="text/javascript"> | |
| // Load jQuery | |
| google.load("jquery", "1.2"); | |
| </script> | |
| <script type="text/javascript"> | |
| google.setOnLoadCallback(function() { | |
| $("input[name=chk]").change( function() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from cProfile import Profile | |
| import pstats | |
| def profile(sort_args=['cumulative'], print_args=[10]): | |
| profiler = Profile() | |
| def decorator(fn): | |
| def inner(*args, **kwargs): | |
| result = None |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import cProfile | |
| def profile_this(fn): | |
| def profiled_fn(*args, **kwargs): | |
| # name for profile dump | |
| fpath = fn.__name__ + '.profile' | |
| prof = cProfile.Profile() | |
| ret = prof.runcall(fn, *args, **kwargs) | |
| prof.dump_stats(fpath) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| JENKINS_HOST=jenkins_host | |
| BASE_URL=http://${JENKINS_HOST}/jenkins/ | |
| SSH_ENDPOINT=$(curl -Lv ${BASE_URL}login 2>&1 | grep 'X-SSH-Endpoint') | |
| USER=$(whoami) | |
| echo "${SSH_ENDPOINT}" | |
| PORT=$(echo "${SSH_ENDPOINT}" | awk -F: '{printf("%d", $3);}' | tr -d "\n") | |
| echo "port=${PORT}" | |
| echo "user=${USER}" | |
| echo "host=${JENKINS_HOST}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # | |
| # 1. create a EC2 instance with public IP | |
| # 2. create a A RR in route53 pointing your.domain.com to the public IP | |
| # 3. make sure HTTP/HTTPS ports(80 443) are public to all in security group of this EC2 instance | |
| # 4. make sure docker daemon is running in this EC2 instance | |
| # 5. run this script ! | |
| # 6. keys/cert will be generated under /root/letsencrypt/etc/live/ | |
| mkdir -p /root/letsencrypt/log /root/letsencrypt/lib /root/letsencrypt/etc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Ubuntu AMI locator | |
| Example: | |
| images = ubuntu_ami_locator() | |
| images = ubuntu_ami_locator(zone=u'us-west-2', virtualization_type=u'hvm') | |
| Reference: | |
| * https://github.com/jspiro/node-ubuntu-ami-locator | |
| """ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| JENKINS_URL="http://localhost/jenkins" | |
| JENKINS_JAR="/tmp/jenkins-cli.jar" | |
| SSL_CHAR=${JENKINS_URL:4:1} | |
| if [ ! -e $JENKINS_JAR ]; then | |
| WGET="wget $JENKINS_URL/jnlpJars/jenkins-cli.jar -O $JENKINS_JAR" | |
| if [ "$SSL_CHAR" == "s"]; then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| VOID OnPaint_TryCombineImage(HDC hdc) | |
| { | |
| Graphics graphics(hdc); | |
| Image image(L"qrcode1.bmp"); | |
| CLSID clsid; | |
| Status status; | |
| UINT num; // number of image encoders | |
| UINT size; // size, in bytes, of the image encoder array | |
| ImageCodecInfo* pImageCodecInfo; |