Skip to content

Instantly share code, notes, and snippets.

View ostretsov's full-sized avatar
🏠
Working from home

Artem Ostretsov ostretsov

🏠
Working from home
View GitHub Profile
@Envek
Envek / extension.js
Created November 22, 2021 17:50
GNOME Shell extension to switch between two most recently used keyboard layouts
// Installation:
// 1. mkdir -p ~/.local/share/gnome-shell/extensions/switch-to-last-keyboard-layout@envek
// 2. cp ./extension.js ./metadata.json ~/.local/share/gnome-shell/extensions/switch-to-last-keyboard-layout@envek
// 3. Restart GNOME Shell (e.g. log out and log in)
// 4. Enable it in the GNOME Extensions App
// Usage:
// gdbus call --session --dest org.gnome.Shell --object-path /org/gnome/Shell/Extensions/SwitchToLastKeyboardLayout --method org.gnome.Shell.Extensions.SwitchToLastKeyboardLayout.Call
const { Gio } = imports.gi;
const { getInputSourceManager } = imports.ui.status.keyboard;
@ryankurte
ryankurte / whatever.service
Created June 16, 2019 03:41
Minimal systemd unit
# place in /etc/systemd/system/whatever.service and install with `systemd install whatever.service`
# note that if you change this file you will need to run `systemctl daemon-reload` to get systemd to notice
[Unit]
Description=A good service description
# After networking because we need that
After=network.target
[Service]
@reachlin
reachlin / prometheus.yml
Created April 19, 2017 07:06
sample prometheus configuration explained
// For all the confusing Prometheus configuration and
// regular expressions,
// explained in examples.
// Remember, there are default values for each item if it's missing.
// regex is (.*),
// replacement is $1,
// separator is ;
// ,and action is replace
@uupaa
uupaa / nginx.conf
Last active February 28, 2023 09:29
nginx: Avoid CORS and reverse proxy settings
http {
server {
listen 8080;
server_name localhost;
charset UTF-8;
# Avoid CORS and reverse proxy settings
# [1] xhr request: http://localhost:8080/api/xxx/yyy/zzz
# [2] /api/xxx/yyy/zzz
# [3] http://your-dev-server.example.com/api/xxx/yyy/zzz
@danielflippance
danielflippance / tinymce-plupload.html
Last active November 4, 2022 18:18
TinyMCE with Plupload Image Selector
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<script src="/plupload-2.1.2/js/plupload.full.min.js"></script>
<script src="/jquery-1.10.1/js/jquery-1.10.1.min.js"></script>
<script src="//tinymce.cachefly.net/4.1/tinymce.min.js"></script>
<script>
//Some code from - http://www.bennadel.com/blog/2564-using-multiple-dropzones-and-file-inputs-with-a-single-plupload-instance.htm
@lologhi
lologhi / 1.How to easily implement a REST API with oAuth2 presentation.md
Last active April 4, 2024 22:13
Symfony2 : How to easily implement a REST API with oAuth2 (for normal guys)

It's still a work in progress...

Intro

As William Durand was recently explaining in his SOS, he "didn't see any other interesting blog post about REST with Symfony recently unfortunately". After spending some long hours to implement an API strongly secured with oAuth, I thought it was time for me to purpose my simple explanation of how to do it.

Ok, you know the bundles

You might have already seen some good explanation of how to easily create a REST API with Symfony2. There are famous really good bundles a.k.a. :

@JamesMGreene
JamesMGreene / gitflow-breakdown.md
Last active May 3, 2024 12:32
`git flow` vs. `git`: A comparison of using `git flow` commands versus raw `git` commands.

Initialize

gitflow git
git flow init git init
  git commit --allow-empty -m "Initial commit"
  git checkout -b develop master

Connect to the remote repository

@swdunlop
swdunlop / identifypanic.go
Created March 18, 2014 20:45
Identify a GOLANG Panic Function and Line in Recovery
// You can edit this code!
// Click here and start typing.
package main
import "fmt"
import "runtime"
import "strings"
func identifyPanic() string {
var name, file string
@denji
denji / http-benchmark.md
Last active May 9, 2024 13:04
HTTP(S) Benchmark Tools / Toolkit for testing/debugging HTTP(S) and restAPI (RESTful)