Skip to content

Instantly share code, notes, and snippets.

@decebal
decebal / grpc_asyncio.py
Created February 15, 2018 13:01 — forked from mmellison/grpc_asyncio.py
gRPC Servicer with Asyncio (Python 3.6+)
View grpc_asyncio.py
import asyncio
from concurrent import futures
import functools
import inspect
import threading
from grpc import _server
def _loop_mgr(loop: asyncio.AbstractEventLoop):
@decebal
decebal / http_get.go
Last active April 13, 2016 13:46 — forked from ijt/http_get.go
Example of using http.Get in go (golang)
View http_get.go
package main
import (
"fmt"
"http"
"io/ioutil"
"os"
)
func main() {
View csv-to-json.php
<?php
/*
* Converts CSV to JSON
* Example uses Google Spreadsheet CSV feed
* csvToArray function I think I found on php.net
*/
header('Content-type: application/json');
// Set your CSV feed
@decebal
decebal / gist:4258064
Created December 11, 2012 12:04
js check
View gist:4258064
$("#countyCheck").change(function() {
$.ajax({
type: "GET",
url: "index.php?page=checkout&action=getcities&countyCheck=" + $(this).val(),
success: function(data) {
//console.log(data);
console.log(data);
$("#cityCheck").html(data);
}
});
@decebal
decebal / gist:4117271
Created November 20, 2012 10:55
Mysql Client
View gist:4117271
To backup:
mysqldump -u user -p DATABASE > backup.sql
To import:
mysql -u user -p DATABASE < backup.sql
View PHP Capistrano Recipe.rb
# --------------------------------------------
# General
# --------------------------------------------
set :shared_children, %w(cache logs) # Shared directories, these directories contain generated content which should not be wiped out during deployments.
set :application, "domain.com" # Application name
set :deploy_to, "/var/www/#{application}/#{stage}" # Path where files are deployed to ...
# --------------------------------------------
# Server
# --------------------------------------------
View gist:3905649
GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' WITH GRANT OPTION;
@decebal
decebal / gist:3832373
Created October 4, 2012 09:04
exclude rsync
View gist:3832373
--exclude 'cs-photos/products'
@decebal
decebal / change_collation.sql
Created October 1, 2012 12:14
Change table collation
View change_collation.sql
alter table csshop_products_prospect convert to character set utf8 collate utf8_general_ci
@decebal
decebal / gist:3720107
Created September 14, 2012 06:07
Lilly
View gist:3720107
usort($result, function($a, $b){
if($a['sortkey'] == $b['sortkey']){
return 0;
}else{
return ($a['sortkey'] > $b['sortkey']) ? 1: -1;
}
});