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
package your.name; | |
import com.ibm.icu.text.CharsetDetector; | |
import java.io.File; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.nio.charset.Charset; | |
import java.nio.file.Files; | |
import java.nio.file.Path; |
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
// Warning: This code is LLM output and has NOT been debugged. | |
const { Octokit } = require("@octokit/rest"); | |
// Initialize the Octokit client | |
const octokit = new Octokit({ auth: "your_personal_access_token" }); | |
// Variables for your specific repository | |
const owner = "your_github_username"; | |
const repo = "your_repository_name"; |
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
package org.gamenet.kata.untestable; | |
import java.sql.*; | |
import java.text.DecimalFormat; | |
public class TransactionLoader { | |
// This is intended as a refactoring / testing kata for improving separation of concerns. | |
// Goal might be to introduce JSON output in addition to XML. | |
public String load() throws SQLException { | |
// Produces result like: |
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 java.io.File; | |
import java.util.Date; | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
public class LockCleaner { | |
private static final Logger logger = LoggerFactory.getLogger(LockCleaner.class); | |
public void clearOldLockInLuceneIndexDir(File indexDir) { |
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
# Last tested in Jenkins 2.22 | |
* | |
!/.gitignore | |
!/*.xml | |
!/nextBuildNumber | |
!/jobs | |
!/jobs/* | |
!/jobs/*/*.xml |
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
const mean = (values) => { | |
let sum = values.reduce((previous, current) => current += previous); | |
return sum / values.length; | |
}; | |
const median = (arr) => { | |
const mid = Math.floor(arr.length / 2); | |
const sorted = [...arr].sort((a, b) => a - b); | |
return arr.length % 2 == 0 ? (sorted[mid - 1] + sorted[mid]) / 2 : sorted[mid]; | |
}; |
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> | |
<!-- CSS --> | |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/styles/github.min.css" /> | |
<link rel="stylesheet" type="text/css" href="vendor-js/diff2html-3.0.0/bundles/css/diff2html.min.css" /> | |
<!-- Javascripts --> | |
<script type="text/javascript" src="vendor-js/diff2html-3.0.0/bundles/js/diff2html-ui.min.js"></script> | |
<script type="text/javascript" src="vendor-js/diff2html-3.0.0/bundles/js/diff2html.min.js"></script> | |
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> |
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 com.google.common.collect.Multimap; | |
import com.google.common.collect.MultimapBuilder; | |
import java.util.Collection; | |
import java.util.function.Consumer; | |
public class AstWalker { | |
private final Multimap<Class<?>, Consumer<?>> enterNodeListeners = MultimapBuilder.linkedHashKeys().arrayListValues().build(); | |
private final Multimap<Class<?>, Consumer<?>> exitNodeListeners = MultimapBuilder.linkedHashKeys().arrayListValues().build(); |
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 boto3 | |
region = 'us-east-1' | |
def find_instance_ids(ec2): | |
response = ec2.describe_instances(Filters=[ | |
{'Name': "tag:StopOffHours", 'Values': ["yes"]} | |
]) | |
return [ | |
instance['InstanceId'] | |
for reservation in response['Reservations'] |
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
unless self.class.const_defined?('SCHEDULER') | |
SCHEDULER = Rufus::Scheduler.new(:lockfile => ".rufus-scheduler.lock") | |
unless SCHEDULER.down? | |
SCHEDULER.every('60s', :first_in => '10s') do | |
active_count = DASHBOARD.find_recent_users(10.minutes.ago).count() | |
# Rails.logger.info "======== active users #{active_count}" | |
Librato.measure('users.active', active_count) | |
end | |
SCHEDULER.every('60s', :first_in => '10s') do |