Skip to content

Instantly share code, notes, and snippets.

View jenya239's full-sized avatar

Evgeniy Arshanskiy jenya239

View GitHub Profile
@kaichao
kaichao / log-http-headers.md
Last active March 7, 2024 18:43
nginx: Log complete request/response with all headers

1. switch nginx image to openresty/openresty

2. add the following to server/location (/etc/nginx/conf.d/default.conf)

   set $req_header "";
   set $resp_header "";
   header_filter_by_lua_block{ 
      local h = ngx.req.get_headers();
      for k, v in pairs(h) do
         ngx.var.req_header = ngx.var.req_header .. k.."="..v.." ";
@kyptin
kyptin / steps.md
Last active October 16, 2023 06:22
Accessing a rails console in Google App Engine (flexible)

If you're running a Rails app in Google App Engine's flexible environment, it takes a bit of setup to get to a rails console attached to your deployed environment. I wanted to document the steps for my own reference and also as an aid to others.

  1. Open the Google App Engine -> instances section of the Google Cloud Platform (GCP) console.

  2. Select the "SSH" drop-down for a running instance. (Which instance? Both of my instances are in the same cluster, and both are running Rails, so it didn't matter for me. YMMV.) You have a choice about how to connect via ssh.

    1. Choose "Open in browser window" to open a web-based SSH session, which is convenient but potentially awkward.

    2. Choose "View gcloud command" to view and copy a gcloud command that you can use from a terminal, which lets you use your favorite terminal app but may require the extra steps of installing the gcloud command and authenticating the gcloud command with GCP.

@darencard
darencard / auto_git_file.md
Last active May 1, 2024 23:18
Automatic file git commit/push upon change

Please see the most up-to-date version of this protocol on my blog at https://darencard.net/blog/.

Automatically push an updated file whenever it is changed

Linux

  1. Make sure inotify-tools is installed (https://github.com/rvoicilas/inotify-tools)
  2. Configure git as usual
  3. Clone the git repository of interest from github and, if necessary, add file you want to monitor
  4. Allow username/password to be cached so you aren't asked everytime
@zeroc0d3
zeroc0d3 / Gemfile.lock
Created February 6, 2017 10:55
Recreate Gemfile.lock
# 1) Copy this template file into root application
# 2) Run: bundle install --no-deployment
GEM
remote: https://rubygems.org/
specs:
PLATFORMS
ruby
@kaspergrubbe
kaspergrubbe / build_termite_and_vte.sh
Created February 3, 2017 03:08
Build termite terminal and vte/vte-ng on Ubuntu
# VTE
apt-get install autoconf libglib2.0-dev gtk-doc-tools libpcre2-dev libgirepository1.0-dev gperf libvte-2.91-dev libvte-dev valac unzip
wget https://github.com/thestinger/vte-ng/archive/0.46.0.a.zip
unzip 0.46.0.a.zip
rm 0.46.0.a.zip
cd vte-ng-0.46.0.a
bash autogen.sh
make && make install
cd ~
rm -rf vte-ng-0.46.0.a/
/* Foo */
.hello
width: 10px
/*
Bar
*/
&:after
height: 30px /* Baz */
@mrliptontea
mrliptontea / sublime-text-3-windows-shortcuts.md
Last active March 30, 2024 04:14 — forked from TheShrike/gist:6111200
Sublime Text 3 - Useful Shortcuts (Windows)

Sublime Text 3 - Useful Shortcuts (Windows)

General

Shortcut Description
Ctrl+Shift+P command prompt
Ctrl+Alt+P switch project
Ctrl+P go to file
Ctrl+G go to line
@mpaepper
mpaepper / android-ubuntu
Last active December 20, 2023 18:26
How to debug your Android device under Ubuntu
When programming apps for Android, you usually want to test them on real Android devices.
This little gist describes how to do so using Ubuntu 14.
First, you need to download and install the Android development IDE (http://developer.android.com/sdk/index.html) and create an Android project which you want to debug.
Next, you need to setup the debugging mode on your Android device. Starting in Android 4.2 you need to enable the developer options first: 1) Go to settings 2) Go to About Phone 3) Tap the build number 10 times (or more, not sure ;)) and you will get the notification that you enabled it.
Then go to the developer settings and enable the debug mode for your phone.
Now you think you can just plug it into your USB mode? - Nope.
@ghinda
ghinda / object-to-form-data.js
Last active March 30, 2024 18:51
JavaScript Object to FormData, with support for nested objects, arrays and File objects. Includes Angular.js usage.
// takes a {} object and returns a FormData object
var objectToFormData = function(obj, form, namespace) {
var fd = form || new FormData();
var formKey;
for(var property in obj) {
if(obj.hasOwnProperty(property)) {
if(namespace) {
@dreamingblackcat
dreamingblackcat / matrix
Last active March 8, 2018 09:15
A simple ruby script for displaying fancy terminal screen
#!/usr/local/bin/ruby
# matrix test with ruby
# Used Two Gems 'curses' for terminal cursor moving and 'rainbow' for coloring
# first run "gem install curses rainbow"
# then run this file
# Note: you can tweak parameters when initializing the object
# Enjoy :)
require "curses"
require 'rainbow/ext/string'