Skip to content

Instantly share code, notes, and snippets.

View mtfelian's full-sized avatar

Artemii Shepelev mtfelian

View GitHub Profile
@dimitardanailov
dimitardanailov / sample-nginx.conf
Last active June 3, 2021 17:30
Configuration for single page application(Framework: Angularjs, Web server: Nginx)
server {
listen 80 default deferred;
server_name myapp.com;
root /var/www/project-folder/;
# Nginx and Angularjs with html mode 5 - https://gist.github.com/cjus/b46a243ba610661a7efb
index index.html;
@fritzy
fritzy / 1_triggers.sql
Last active March 16, 2025 15:06
Get table change notifications from Postgres as JSON
CREATE OR REPLACE FUNCTION table_update_notify() RETURNS trigger AS $$
DECLARE
id bigint;
BEGIN
IF TG_OP = 'INSERT' OR TG_OP = 'UPDATE' THEN
id = NEW.id;
ELSE
id = OLD.id;
END IF;
PERFORM pg_notify('table_update', json_build_object('table', TG_TABLE_NAME, 'id', id, 'type', TG_OP)::text);
@jakeemerson
jakeemerson / handy_es_queries
Last active June 23, 2022 14:25
helpful elastic search queries
## get all the pageviews on the boundary-vpc host in the last hour, sort by timestamp
curl -X GET "http://elastic-04:9200/logstash-2015.03.31/_search/?pretty" -d'
{
"query": {
"filtered": {
"query": {
"match": {"host" : "boundary-vpc"}
},
"filter": {
@ipedrazas
ipedrazas / gist:2c93f6e74737d1f8a791
Created September 18, 2014 22:13
List Docker Container Names and IPs
function drips(){
docker ps -q | xargs -n 1 docker inspect --format '{{ .NetworkSettings.IPAddress }} {{ .Name }}' | sed 's/ \// /'
}
@cryptix
cryptix / vineScrape.go
Created August 27, 2014 12:31
extract a javascript object value from a html page using goquery and otto
package main
import (
"errors"
"log"
"os"
"github.com/PuerkitoBio/goquery"
"github.com/robertkrimen/otto"
)
@michaljemala
michaljemala / tls-client.go
Last active April 21, 2025 07:12
SSL Client Authentication Golang sample
package main
import (
"crypto/tls"
"crypto/x509"
"flag"
"io/ioutil"
"log"
"net/http"
)
@ismasan
ismasan / sse.go
Last active February 27, 2025 00:15
Example SSE server in Golang
// Copyright (c) 2017 Ismael Celis
// 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:
// The above copyright notice and this permission notice shall be included in all
# from http://sdiehl.github.io/gevent-tutorial/
from gevent import sleep
from gevent.pool import Pool
from gevent.coros import BoundedSemaphore
sem = BoundedSemaphore(4) # only allows 4 greenlets at one time, others must wait until one is released
def worker1(n):
sem.acquire()
@Stanback
Stanback / nginx.conf
Last active March 30, 2025 03:57 — forked from michiel/cors-nginx.conf
Example Nginx configuration for adding cross-origin resource sharing (CORS) support to reverse proxied APIs
#
# CORS header support
#
# One way to use this is by placing it into a file called "cors_support"
# under your Nginx configuration directory and placing the following
# statement inside your **location** block(s):
#
# include cors_support;
#
# As of Nginx 1.7.5, add_header supports an "always" parameter which
@donpdonp
donpdonp / gist:4997294
Created February 20, 2013 17:25
bitcoin-qt command line arguments
$ bitcoin-qt --help
Bitcoin-Qt version v0.7.2-beta
Usage:
bitcoin-qt [command-line options]
Options:
-? This help message
-conf=<file> Specify configuration file (default: bitcoin.conf)
-pid=<file> Specify pid file (default: bitcoind.pid)