Skip to content

Instantly share code, notes, and snippets.

View magirtopcu's full-sized avatar
🎯
Focusing

Mehmet magirtopcu

🎯
Focusing
View GitHub Profile
@magirtopcu
magirtopcu / deep-search-javascript-object.js
Last active November 20, 2018 07:13 — forked from YagoLopez/deep-search-javascript-object.js
Deep search javascript object
/* Attribution: http://techslides.com/how-to-parse-and-search-json-in-javascript */
//return an array of object path and value according to key
function getValues(obj, key,path) {
var objects = [];
for (var i in obj) {
if (!obj.hasOwnProperty(i)) continue;
if (typeof obj[i] == 'object') {
objects = objects.concat(getValues(obj[i], key,path+"/"+i));
} else if (i == key) {
@magirtopcu
magirtopcu / TinyJsonMapper.java
Last active November 11, 2018 20:38
Deadly simple JSON serializing of java pojos
package core;
import java.lang.reflect.Field;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
public class TinyJsonMapper {
@magirtopcu
magirtopcu / Dockerfile
Created July 15, 2018 17:50
Tensorflow object detection docker
FROM "ubuntu"
RUN apt-get update && yes | apt-get upgrade
RUN mkdir -p /tensorflow/models
RUN apt-get install -y git python-pip curl unzip
RUN curl -OL https://github.com/google/protobuf/releases/download/v3.2.0/protoc-3.2.0-linux-x86_64.zip
RUN unzip protoc-3.2.0-linux-x86_64.zip -d protoc3
RUN mv protoc3/bin/* /usr/local/bin/
RUN mv protoc3/include/* /usr/local/include/
RUN protoc --version
RUN pip install tensorflow
@magirtopcu
magirtopcu / E-devlet Alt-Üst Soy Bilgisi Tree
Created February 14, 2018 22:36
E devlet Alt Üst Soy bilgisini table'dan tree'ye çevirir
var temp1 =[];
$(".resultTable.striped tr").each(function(){
var k = [];
$(this).find("td").each(function(){
k.push($(this).text());
});
temp1.push(k);
});
temp1.splice(0,1);

What / Why

Deploy key is a SSH key set in your repo to grant client read-only (as well as r/w, if you want) access to your repo.

As the name says, its primary function is to be used in the deploy process, where only read access is needed. Therefore keep the repo safe from the attack, in case the server side is fallen.

How to

  1. Generate a ssh key
@magirtopcu
magirtopcu / es_simple_autocomplete_example_config.sh
Created June 23, 2017 13:33 — forked from justinvw/es_simple_autocomplete_example_config.sh
Simple ElasticSearch autocomplete example configuration. The 'autocomplete' functionality is accomplished by lowercasing, character folding and n-gram tokenization of a specific indexed field (in this case "city").
# Delete the possibly existing autocomplete test index
curl -X DELETE localhost:9200/autocomplete_test
# Put the config of the autocomplete index
curl -X PUT localhost:9200/autocomplete_test -d '
{
"settings" : {
"index" : {
"analysis" : {
"analyzer" : {
@magirtopcu
magirtopcu / mnc mcc sql
Created March 23, 2017 08:21
Mobile carriers codes ( mnc , mcc ) create and insert sql. Converted from https://github.com/pbakondy/mcc-mnc-list
CREATE TABLE `carriers` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`type` varchar(13) CHARACTER SET utf8 DEFAULT NULL,
`countryName` varchar(56) CHARACTER SET utf8 DEFAULT NULL,
`countryCode` varchar(14) CHARACTER SET utf8 DEFAULT NULL,
`mcc` int(11) DEFAULT NULL,
`mnc` varchar(9) CHARACTER SET utf8 DEFAULT NULL,
`brand` varchar(48) CHARACTER SET utf8 DEFAULT NULL,
`operator` varchar(75) CHARACTER SET utf8 DEFAULT NULL,
`status` varchar(21) CHARACTER SET utf8 DEFAULT NULL,
@magirtopcu
magirtopcu / README.md
Created September 27, 2016 07:15 — forked from oodavid/README.md
Backup MySQL to Amazon S3

Backup MySQL to Amazon S3

This is a simple way to backup your MySQL tables to Amazon S3 for a nightly backup - this is all to be done on your server :-)

Sister Document - Restore MySQL from Amazon S3 - read that next

1 - Install s3cmd

this is for Centos 5.6, see http://s3tools.org/repositories for other systems like ubuntu etc

@magirtopcu
magirtopcu / README.md
Created September 27, 2016 07:15 — forked from oodavid/README.md
Restore MySQL from Amazon S3

Restore MySQL from Amazon S3

This is a hands-on way to pull down a set of MySQL dumps from Amazon S3 and restore your database with it

Sister Document - Backup MySQL to Amazon S3 - read that first

1 - Set your MySQL password and S3 bucket, make a temp dir, get a list of snapshots

# Set our variables

export mysqlpass="ROOTPASSWORD"