Skip to content

Instantly share code, notes, and snippets.

Nicolas Cornette ncornette

  • Paris
View GitHub Profile
View i3_config
# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout some time, delete
# this file and re-run i3-config-wizard(1).
#
# i3 config file (v4)
#
# Please see https://i3wm.org/docs/userguide.html for a complete reference!
View Default for GNOME FR.xml
<keymap version="1" name="Default for GNOME FR" parent="Default for GNOME">
<action id="ActivateAndroidMonitorToolWindow">
<keyboard-shortcut first-keystroke="alt 6" />
<keyboard-shortcut first-keystroke="alt minus" />
</action>
<action id="ActivateChangesToolWindow">
<keyboard-shortcut first-keystroke="alt 9" />
<keyboard-shortcut first-keystroke="alt #10000c7" />
</action>
<action id="ActivateDebugToolWindow">
@ncornette
ncornette / KotlinTimeUnitTest.kt
Last active Feb 20, 2020
Kotlin extension functions for java TimeUnit
View KotlinTimeUnitTest.kt
package utils
import org.assertj.core.api.Assertions
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.Parameterized
import java.util.concurrent.TimeUnit
@RunWith(Parameterized::class)
class KotlinTimeUnitTest(private val timeValue: Long) {
@ncornette
ncornette / Default for XWin FR.xml
Last active Apr 2, 2017
IntelliJ keymap for FR keyboard layout with alt+[1-9] key bindings
View Default for XWin FR.xml
<keymap version="1" name="Default for XWin FR" parent="Default for XWin">
<action id="ActivateAndroidMonitorToolWindow">
<keyboard-shortcut first-keystroke="alt 6" />
<keyboard-shortcut first-keystroke="alt minus" />
</action>
<action id="ActivateChangesToolWindow">
<keyboard-shortcut first-keystroke="alt 9" />
<keyboard-shortcut first-keystroke="alt #10000c7" />
</action>
<action id="ActivateDebugToolWindow">
@ncornette
ncornette / unused-layouts.sh
Created Nov 19, 2015
Command to find unused layouts in android project
View unused-layouts.sh
#!/bin/bash
# Find Unused (unreferences) layouts in android project
for f in `find ./src -iname "*.xml" | grep res/layout`; do echo $f ; git grep --count -e "R\.layout\.$(basename $f .xml)\W" --or -e "@layout/$(basename $f .xml)\W" | wc -l ; done | grep -B1 "^0"
View DynamicProxy.java
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
public class DynamicProxy {
private static final InvocationHandler INVOKE_DO_NOTHING = new InvocationHandler() {
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
return null;
View DateDiffTest.java
package com.vsct;
import org.junit.Test;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.concurrent.TimeUnit;
import static org.junit.Assert.assertEquals;
@ncornette
ncornette / gist:77fdf6ee4777965813d4
Created Feb 19, 2015
Git track all remote branches
View gist:77fdf6ee4777965813d4
#1 create fresh git clone
#2 track all remote branches
for b in `git branch -r | sed "s/ origin\///g"`; do git branch $b -t origin/$b; done
View webview.py
#!/usr/bin/env python
import sys
import gtk
from gtk import gdk
import webkit
import gobject
page_url = len(sys.argv)>1 and sys.argv[1] or 'http://www.google.com'
gobject.threads_init()
win = gtk.Window()
@ncornette
ncornette / .xinitrc
Created Dec 4, 2014
.xinitrc for kiosk mode
View .xinitrc
#!/bin/sh
# invoke global X session script
#. /etc/X11/Xsession
# HOW-TO :
# 1. Disable any Display Manager (lightdm/gdm/gdm3) from executing on startup
# 2. Allow user to start X :
# a. Edit /etc/X11/Xwrapper.config
# b. Set value : "allowed_users=anybody"
# 3. insert "su kiosk -c xinit &" into /etc/rc.local
You can’t perform that action at this time.