Skip to content

Instantly share code, notes, and snippets.

View jakub-g's full-sized avatar

jakub-g jakub-g

  • Antibes, France
  • 09:42 (UTC +02:00)
View GitHub Profile
@jakub-g
jakub-g / snippets.js
Last active February 16, 2017 12:29
robust cd, execSync wrappers for nodejs 0.12+ and shelljs
var path = require('path');
var clc = require('cli-color');
var shelljs = require('shelljs');
function cd(dir) {
dir = path.resolve(dir)
shelljs.cd(dir);
var cwd = path.resolve(process.cwd());
@jakub-g
jakub-g / open-atlassian-stash-pullrequest.sh
Last active February 22, 2017 05:27
Open Atlassian Stash pull request from command line (open browser at the right URL)
#!/bin/bash
##################################################################
# Open Atlassian Stash pull request from command line.
# (opens the default browser at the proper URL with data prefilled)
#
# It infers current branch name, repo name, current user name, from git config.
############################### CONFIG ###########################
URL_PREFIX="http://stash.yourcompany.com"
@jakub-g
jakub-g / WarningBeforeCertExpires.js
Created March 18, 2017 20:15 — forked from ericlaw1979/WarningBeforeCertExpires.js
This FiddlerScript highlights in red Sessions secured by certificates that will expire in the next 30 days
// Inside Rules > Customize Rules > OnBoot, add the following line:
FiddlerApplication.add_OnValidateServerCertificate(onEvalCert);
// Just before that function, add the following new function:
static function onEvalCert(o: Object, e: ValidateServerCertificateEventArgs)
{
try
{
var X2: System.Security.Cryptography.X509Certificates.X509Certificate2 =
new System.Security.Cryptography.X509Certificates.X509Certificate2(e.ServerCertificate);
@jakub-g
jakub-g / gist:a5a44092175f1fd2e1aa5fd80531f6d7
Created March 19, 2017 00:00
FiddlerScript: lint caching headers (to be put in OnPeekAtResponseHeaders)
static function checkForInvalidCachingHeaders(oSession: Session) {
// var _temp : int = 0;
// && !(int.TryParse(oSession.oResponse["Expires"], out _temp))
if (oSession.oResponse.headers.Exists("Expires")
&& oSession.oResponse.headers.Exists("Date")
&& oSession.oResponse.headers.ExistsAndContains("Cache-Control", "max-age"))
{
try {
@jakub-g
jakub-g / findAndRenameInGit.sh
Created April 4, 2017 14:11
find and rename version controlled files
git ls-files | grep _jp | sed -e 'p;s/_jp/_ja/' | xargs -n2 mv
@jakub-g
jakub-g / gist:971e4d3d35ac00a11e87b42e785edb6e
Created July 3, 2017 12:25
Moving stuff away from C:\ on Windows
GRADLE_USER_HOME=D:\cache\gradle
http://www.littlecpu.com/android-studio-c-drive
@jakub-g
jakub-g / gist:2cf3fc8b2beeb14263291737685ccb91
Created July 12, 2017 13:38
Gradle spotbugs stacktrace
* Exception is:
org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':app'.
at org.gradle.configuration.project.LifecycleProjectEvaluator.addConfigurationFailure(LifecycleProjectEvaluator.java:94)
at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:89)
at org.gradle.configuration.project.LifecycleProjectEvaluator.doConfigure(LifecycleProjectEvaluator.java:76)
at org.gradle.configuration.project.LifecycleProjectEvaluator.access$000(LifecycleProjectEvaluator.java:33)
at org.gradle.configuration.project.LifecycleProjectEvaluator$1.execute(LifecycleProjectEvaluator.java:53)
at org.gradle.configuration.project.LifecycleProjectEvaluator$1.execute(LifecycleProjectEvaluator.java:50)
at org.gradle.internal.Transformers$4.transform(Transformers.java:169)
# -------------- In my case it was this location, change accordingly -----------
# I only show here the part of that file I changed
## [ v3_req ]
##
### Extensions to add to a certificate request
##
##basicConstraints = CA:FALSE
##keyUsage = nonRepudiation, digitalSignature, keyEncipherment
[ v3_req ]
@jakub-g
jakub-g / gist:d3349e8bab99ab7b08fdccf92662a9aa
Last active September 23, 2017 23:31
Generating self-signed SSL cert for node's http-server on Windows (Git Bash)

Quick tutorial how to serve current working directory over https, using self-signed cert, on Windows, from Git Bash, with NodeJS

npm install -g http-server

// follow this first if you use OpenSSL from Git Bash
https://gist.github.com/jakub-g/23699ec40cc23e5b8adfd8c9261487d6

// go to the folder that is to be served

cd /some/dir

@jakub-g
jakub-g / repro-1402874472.md
Last active October 31, 2017 14:49
Mouse clicks not dispatched on Windows 7 starting August 2017 when wireless MS Sculpt Ergonomic Mouse is enabled

Steps to reproduce:

  1. Have Windows 7 fully patched (September-October 2017 patch level).
  2. Get MS sculpt ergonomic mouse.
  3. Connect the USB dongle that ships with the mouse to the USB port of the machine.
  4. Enable the mouse via a physical switch on the bottom side of the mouse. (for information, I have a mouse + keyboard, aka Sculpt Ergonomic Desktop https://www.microsoft.com/accessories/en-us/products/keyboards/sculpt-ergonomic-desktop/l5v-00001 that share the same USB dongle).
  5. Open Sublime Text 3, or Intellij IDEA, or Android Studio 2.3. Try to type or select some text.

!! unable to click anywhere in the text edit component, click menu entries & menu buttons.