Skip to content

Instantly share code, notes, and snippets.

View JonBons's full-sized avatar

JonBons

View GitHub Profile
@JonBons
JonBons / gist:62ca4b6957c3e11689b5
Last active February 22, 2018 04:55
Learning F# with Hacker Rank
open System
//leaderboard #1
let leaderboard1 =
let ln = System.Console.In.ReadLine //;;
[1..(int (ln()))] |> List.map (fun x-> ln().Split([|' '|]) |> Array.map int |> Array.reduce (+)) |> List.iter System.Console.WriteLine
//leaderboard #2
let leaderboard2 =
@JonBons
JonBons / gist:c3231df4c77ed441a06f
Last active May 24, 2018 13:36
Google Sheets - Calculate SUM file size in-between headers
//above is inline code from filesize.js
function MODPACK_SIZE(column, targetColumn, name) {
var sh = SpreadsheetApp.getActiveSheet();
var data = sh.getDataRange().getValues();
var iStart = -1;
var iEnd = data.length;
// Find start
/* Vedant Misra (vedantmisra.com) (github.com/vedant)
*
* Script for exporting Google Keep note files.
*
* This does not handle attachments or checklists, only note files. Downloads
* each note to a .txt file named for the note's title.
*
* To use this, go to https://drive.google.com/keep/ and wait for the page to
* fully load all of your saved notes; scroll to the bottom to confirm they're
* loaded. Then paste the below in your URI bar, go to the start of the line,
/*
================================================================================
DESCRIPTION:
Activates DAC zones and sends all units within to attack a certain location.
AUTHOR:
Nife
PARAMETERS:
@JonBons
JonBons / gist:e1a4cad162dc691a05a1
Created March 25, 2015 18:08
HG: update to branch
function UpdateToBranch {
$return = hg branches | Select-String $args
Write-Host $return
if (($return | Measure-Object).Count -eq 1) {
'Updating to branch...'
$line = $return.ToString().Trim()
$line = $line -replace " ([0-9]*?):(.*?)$", ""
@JonBons
JonBons / csvdump.sqf
Last active August 29, 2015 14:17 — forked from Wolfenswan/csvdump.sqf
///////// XML & CSV EXPORT
///////// Usage: [name,CfgPatches name]
///////// Usage: [name] to export bis stuff
///////// Usage: Paste everything below in the debug console and run it
_CfgPatches = false;
_configPath = "";
_collectionName = "test";
if(count [] > 1) then
{
@JonBons
JonBons / gist:65788094c3e2e52684f0
Last active August 29, 2015 14:16
Script to automatically build compatibility configs.
_vm = [] execVM "buildTranslationData.sqf";
waitUntil {scriptDone _vm};
//TODO LIST
/*
Soon:
Attempt to build CfgPatches entries for legacy mods
Build CfgMagazines based upon a list of all legacy magazines used in the below CfgWeapons array
@JonBons
JonBons / aiHearTalking.sqf
Last active August 29, 2015 14:16
AI hear players talking via TFAR
//Written by beta and Krause for ACRE, converted to TFAR by JonBons
//AI can hear you talk on TFAR
//version 2
private ["_nearAI", "_revealAmount", "_sideUnit", "_nearAISingle", "_sideAI", "_sideUnits", "_inContact", "_enemyInContact", "_talkTime", "_dist"];
_talkTime = 0;
b_hasRadioCheck =
{
ffmpeg.exe -i input_video.mp4 -i replacement_audio.m4a -vcodec copy -acodec copy -map 0:0 -map 1:0 output.mp4
$nextTagID = 0;
Function getTag() {
$global:nextTagID += 1;
return 'foo' + $global:nextTagID
}
Function makeRandom($length){
$text = '';
for($i=1; $i -le $length; $i++){
$text += [char](get-random -Minimum 65 -Maximum 90);