Skip to content

Instantly share code, notes, and snippets.

View alexkunin's full-sized avatar

Alex Kunin alexkunin

View GitHub Profile
#!/usr/bin/env bash
HOST=remote.host
IFACE=127.0.0.1
PORT=1234
SOCKET=remote-docker-socket.${HOST}
ssh -M -S ${SOCKET} -o ExitOnForwardFailure=yes -fNTL ${IFACE}:${PORT}:/var/run/docker.sock ${HOST} && (
DOCKER_HOST=tcp://${IFACE}:${PORT} docker-compose $*
ssh -S ${SOCKET} -O exit ${HOST} 2> /dev/null
<?php
function func($param) {
return $param;
}
class A
{
public static function staticMethod($param) {
return $param;
}
@alexkunin
alexkunin / code.js
Created August 30, 2013 22:02
Solution to https://github.com/angular-ui/ui-router/pull/73, sugar-enabled alternative to https://gist.github.com/MattWalker/6106393. Includes "dependency reordering' (sort of) and circular reference checks.
angular.module("yourApp").provider("$stateProviderWrapper", function ($stateProvider, $injector) {
var stack = {
"":{}
};
return {
$get:function () {
},
state:function (name, definition) {
<?php
$url = "https://docs.google.com/...";
$rows = array_map(
'str_getcsv',
explode(
"\n",
`wget --no-check-certificate -O - -nv -q "$url"`
)
);
?>
@alexkunin
alexkunin / long.php
Last active December 20, 2015 21:19
<?php
function get_goodle_drive_spreadsheet($url) {
try {
// We are going to use temporary file:
$fh = fopen("php://temp", "w+");
if (!$fh) {
throw new Exception("Can't open temporary file");
}
$ch = curl_init($url);