Skip to content

Instantly share code, notes, and snippets.

View artembeloglazov's full-sized avatar
🚴

Artem Beloglazov artembeloglazov

🚴
View GitHub Profile
@sente
sente / formatXML.js
Last active April 4, 2024 12:20
javascript to format/pretty-print XML
The MIT License (MIT)
Copyright (c) 2016 Stuart Powers
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@johnwards
johnwards / lastValue.js
Created May 15, 2012 11:39
get the value of last row in a sheet in google docs
function lastValue(column) {
var parts = column.split("!");
if (parts.length == 2) {
var sheetName = parts[0];
var column = parts[1];
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(sheetName);
} else {
var column = parts[0];
var sheet = SpreadsheetApp.getActiveSheet();
}
@philfreo
philfreo / gist:3877368
Created October 12, 2012 04:49
Various Backbone-Form custom editors
// like 'Select' editor, but will always return a boolean (true or false)
editors.BooleanSelect = editors.Select.extend({
initialize: function(options) {
options.schema.options = [
{ val: '1', label: 'Yes' },
{ val: '', label: 'No' }
];
editors.Select.prototype.initialize.call(this, options);
},
getValue: function() {
@EmbeddedAndroid
EmbeddedAndroid / qemu-ifup
Created September 15, 2013 17:24
Mac OSX (10.8.X) /etc/qemu-ifup script for QEMU/KVM bridged networking.
#!/bin/bash
echo "Executing /etc/qemu-ifup"
echo "Creating bridge"
sysctl -w net.link.ether.inet.proxyall=1
sysctl -w net.inet.ip.forwarding=1
sysctl -w net.inet.ip.fw.enable=1
ifconfig bridge0 create
echo "Bringing up $1 for bridged mode"
ifconfig $1 0.0.0.0 up
echo "Add $1 to bridge"
@EmbeddedAndroid
EmbeddedAndroid / qemu-ifdown
Created September 15, 2013 17:38
Mac OSX (10.8.X) /etc/qemu-ifdown script for QEMU/KVM bridged networking.
#!/bin/bash
echo "Executing /etc/qemu-ifdown"
echo "Bringing TAP interface down"
ifconfig $1 down
echo "Removing interfaces"
ifconfig bridge0 deletem en0 deletem $1
echo "Bring down bridge"
ifconfig bridge0 down
echo "Removing bridge"
ifconfig bridge0 destroy
@sroze
sroze / MyCommand.php
Last active June 6, 2021 13:58
Symfony Command that read file from file name or STDIN
<?php
namespace AmceBundle\Command;
class MyCommand
{
// ...
protected function execute(InputInterface $input, OutputInterface $output)
{