Skip to content

Instantly share code, notes, and snippets.

@s1s1ty
s1s1ty / go-sql-route.go
Last active September 19, 2023 03:42
1st part
package main
import (
"github.com/go-chi/chi"
"github.com/go-chi/chi/middleware"
_ "github.com/go-sql-driver/mysql"
)
var router *chi.Mux
var db *sql.DB
#include <sstream>
stringstream ss;
string s; //main string
string newString; //new string
ss << s; //assign s to ss
while(ss >> newString) { // Spilit string
@s1s1ty
s1s1ty / sample.rq
Last active January 18, 2021 01:46
PREFIX ab: <http://learningsparql.com/ns/addressbook#>
SELECT ?name
WHERE {
?name ab:email "richard49@hotmail.com" .
}
@prefix ab: <http://learningsparql.com/ns/addressbook#> .
ab:ali_gatie ab:borns "Yemen" .
ab:ali_gatie ab:homeTel "01700000" .
ab:ali_gatie ab:email "ali_gatie@hotmail.com" .
# If we want to add more person...
ab:richard ab:borns "Berlin" .
ab:richard ab:homeTel "01700001" .
ab:richard ab:email "richard49@hotmail.com" .
@s1s1ty
s1s1ty / sample.ttl
Last active January 18, 2021 00:44
@prefix ab: <http://learningsparql.com/ns/addressbook#> .
ab:ali_gatie ab:borns "Yemen" ;
ab:homeTel "01700000" ;
ab:email "ali_gatie@hotmail.com" .
# If we want to add more person...
ab:richard ab:borns "Berlin" ;
ab:homeTel "01700001" ;
ab:email "richard49@hotmail.com" .
type Post struct {
ID int `json: "id"`
Title string `json: "title"`
Content string `json: "content"`
}
@s1s1ty
s1s1ty / post-mysql.go
Created July 31, 2018 07:25
post-mysql
package post
import (
"context"
"database/sql"
models "github.com/s1s1ty/go-mysql-crud/models"
pRepo "github.com/s1s1ty/go-mysql-crud/repository"
)
@s1s1ty
s1s1ty / logstash-export-csv.conf
Created December 27, 2018 15:23
export elastic to csv
input {
elasticsearch {
hosts => "localhost:9200"
index => "give_index_name"
query => '
{
"query": {
"match_all": {}
}
}
# delete all data from _doc
curl -XPOST 'localhost:9200/pathao/zone_path/_delete_by_query?conflicts=proceed&pretty' -d'
{
"query": {
"match_all": {}
}
}'
@s1s1ty
s1s1ty / s_i.py
Created August 24, 2018 18:53
30-days-python-code
#!/bin/python3
S = input().strip()
try:
print(int(S))
except ValueError:
print('Bad String')