Skip to content

Instantly share code, notes, and snippets.

@lasombra
lasombra / gitcheats.txt
Created March 29, 2016 15:22 — forked from chrismccoy/gitcheats.txt
git cheats
# shortform git commands
alias g='git'
# count relevant lines of shell code in a git repo
egrep -v '^\s*($|#)' $(git grep -l '#!/bin/.*sh' *) | wc -l
# push all remotes
for i in `git remote`; do git push $i; done;
# cherry pick range of commits, starting from the tip of 'master', into 'preview' branch

I hereby claim:

  • I am lasombra on github.
  • I am lasombra (https://keybase.io/lasombra) on keybase.
  • I have a public key ASBsVgkFYLK1qKnU9GpxFTZJsE8DFu7IJOrTXXj84nk6Uwo

To claim this, I am signing this object:

{
@lasombra
lasombra / gist:983dbadfea0452e9611d95041e705a58
Created November 10, 2016 07:44 — forked from tonymtz/gist:714e73ccb79e21c4fc9c
Uninstall XQuartz.app from OSX Yosemite
launchctl unload /Library/LaunchAgents/org.macosforge.xquartz.startx.plist
sudo launchctl unload /Library/LaunchDaemons/org.macosforge.xquartz.privileged_startx.plist
sudo rm -rf /opt/X11* /Library/Launch*/org.macosforge.xquartz.* /Applications/Utilities/XQuartz.app /etc/*paths.d/*XQuartz
sudo pkgutil --forget org.macosforge.xquartz.pkg
# Log out and log in
#!/bin/bash
# export DBUS_SESSION_BUS_ADDRESS environment variable because cron hates me
PID=$(pgrep -u USER gnome-session-b)
export DBUS_SESSION_BUS_ADDRESS=$(grep -z DBUS_SESSION_BUS_ADDRESS /proc/$PID/environ|cut -d= -f2-)
/usr/bin/gsettings set org.gnome.shell.extensions.user-theme name 'Flat-Plat'
/usr/bin/gsettings set org.gnome.desktop.interface gtk-theme 'Flat-Plat'
/usr/bin/gsettings set org.gnome.desktop.background picture-uri 'file://WALLPAPER-PATH'
/usr/bin/gsettings --schemadir ~/.local/share/gnome-shell/extensions/drop-down-terminal@gs-extensions.zzrough.org set org.zzrough.gs-extensions.drop-down-terminal background-color 'rgb(69,90,100)'
@lasombra
lasombra / FileWatcher.java
Created April 22, 2017 09:30 — forked from danielflower/FileWatcher.java
Watching a single file in java
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.nio.file.*;
public class FileWatcher {
private static final Logger log = LoggerFactory.getLogger(FileWatcher.class);
private Thread thread;

Quick Tips for Fast Code on the JVM

I was talking to a coworker recently about general techniques that almost always form the core of any effort to write very fast, down-to-the-metal hot path code on the JVM, and they pointed out that there really isn't a particularly good place to go for this information. It occurred to me that, really, I had more or less picked up all of it by word of mouth and experience, and there just aren't any good reference sources on the topic. So… here's my word of mouth.

This is by no means a comprehensive gist. It's also important to understand that the techniques that I outline in here are not 100% absolute either. Performance on the JVM is an incredibly complicated subject, and while there are rules that almost always hold true, the "almost" remains very salient. Also, for many or even most applications, there will be other techniques that I'm not mentioning which will have a greater impact. JMH, Java Flight Recorder, and a good profiler are your very best friend! Mea

@lasombra
lasombra / tlp
Created February 17, 2019 13:40 — forked from pauloromeira/tlp
My TLP config file (/etc/default/tlp) for ThinkPad
# ------------------------------------------------------------------------------
# tlp - Parameters for power saving
# See full explanation: http://linrunner.de/en/tlp/docs/tlp-configuration.html
# dir: /etc/default/tlp
# Hint: some features are disabled by default, remove the leading # to enable
# them.
# Set to 0 to disable, 1 to enable TLP.
@lasombra
lasombra / asdasd
Created September 27, 2019 11:58
asdasd
%global namedreltag .Final
%global namedversion %{version}%{?namedreltag}
%global majorversion 6
Name: hibernate-validator
Version: 6.0.17
Release: 1%{?dist}
Summary: Bean Validation 2.0 (JSR 380) Reference Implementation
License: ASL 2.0
URL: https://hibernate.org/validator/
Source0: https://github.com/hibernate/hibernate-validator/archive/%{namedversion}/%{name}-%{namedversion}.tar.gz
@lasombra
lasombra / fix_maildir_mail_mtime.py
Created July 8, 2020 18:42 — forked from artizirk/fix_maildir_mail_mtime.py
This script is useful for setting fallback mtime for isync/mbsync CopyArrivalDate option
#!/usr/bin/env python3
# This script is useful for setting fallback mtime for isync/mbsync CopyArrivalDate option
# If you use notmuch then you could do something like this to fix mtime on new mail
# notmuch search --output=files tag:new | xargs -P0 -i ~/code/mailutils/fix_maildir_mtime.py {}
import email
import sys
import os
from email.utils import parsedate_tz, mktime_tz