Skip to content

Instantly share code, notes, and snippets.

@c0mpiler
c0mpiler / Utils.java
Last active January 17, 2018 20:25
Print File descriptors count
package com.ibm.labbook.utils;
import com.ibm.lang.management.ExtendedOperatingSystem;
import com.ibm.lang.management.ManagementUtils;
import com.ibm.lang.management.OperatingSystemMXBean;
import com.ibm.lang.management.UnixOperatingSystemMXBean;
@SuppressWarnings("restriction")
public class SystemUtil{
@c0mpiler
c0mpiler / file_handles.sh
Last active January 22, 2018 18:20
Monitor the number of file handles opened by the web-app and handle as needed
# run this script as a cron job or using watch
#
# e.g:
# Using 'watch' - to run the script every 5 mins
# # watch -n 300 ./file_handles.sh
#
# Using a cron job to run every 5 mins. Run
# # crontab –e
# then add the following line to the editor
# '*/10 * * * * /home/hvkrishn/file_handles.sh'
@c0mpiler
c0mpiler / HelloQbit.java
Created February 13, 2018 23:50
HelloQbit
import HelloWorldService;
import io.advantageous.qbit.admin.ManagedServiceBuilder;
import io.advantageous.qbit.http.request.HttpBinaryResponse;
import io.advantageous.qbit.http.request.HttpResponseBuilder;
import io.advantageous.qbit.http.request.HttpTextResponse;
import io.advantageous.qbit.http.request.decorator.HttpBinaryResponseHolder;
import io.advantageous.qbit.http.request.decorator.HttpResponseDecorator;
import io.advantageous.qbit.http.request.decorator.HttpTextResponseHolder;
@c0mpiler
c0mpiler / iTerm2.md
Created February 16, 2018 21:06
iterm2 cheatsheet

Tabs and Windows

Function Shortcut
Fullscreen + Enter
Previous Tab + Left Arrow
Next Tab + Right Arrow
Go to Tab + Number
Go to Window + Option + Number
Go to Split Pane by Direction + Option + Arrow
@c0mpiler
c0mpiler / install-docker-rhel7.sh
Created March 6, 2018 19:47
Install Docker CE on RHEL
# pre-requisite for container-selinux-2.9-4.el7.noarch.rpm
sudo yum install policycoreutils-python
wget http://mirror.centos.org/centos/7/extras/x86_64/Packages/container-selinux-2.21-1.el7.noarch.rpm
sudo rpm -i container-selinux-2.21-1.el7.noarch.rpm
#Set up the Docker CE repository on RHEL:
sudo yum install -y yum-utils
sudo yum install -y device-mapper-persistent-data lvm2
sudo yum-config-manager --enable rhel-7-server-extras-rpms
@c0mpiler
c0mpiler / my-es-test.sh
Last active March 8, 2018 20:05
ElasticSearch settings
root@harsha:~# curl -XPUT 'localhost:9200/_settings?pretty' -H 'Content-Type: application/json' -d' { "index": { "refresh_interval": "30s" } } '
{
"acknowledged" : true
}
root@harsha:~# curl -XPUT 'localhost:9200/_settings?pretty' -H 'Content-Type: application/json' -d' { "index": { "number_of_replicas": "0" } } '
{
@c0mpiler
c0mpiler / keycloakerror.log
Created June 22, 2018 04:20
KeyCloak Github error
04:00:36,290 ERROR [org.keycloak.broker.oidc.AbstractOAuth2IdentityProvider] (default task-163) Failed to make identity provider oauth callback: org.keycloak.broker.provider.IdentityBrokerException: Could not obtain user profile from github.
at org.keycloak.social.github.GitHubIdentityProvider.doGetFederatedIdentity(GitHubIdentityProvider.java:92)
at org.keycloak.broker.oidc.AbstractOAuth2IdentityProvider.getFederatedIdentity(AbstractOAuth2IdentityProvider.java:283)
at org.keycloak.broker.oidc.AbstractOAuth2IdentityProvider$Endpoint.authResponse(AbstractOAuth2IdentityProvider.java:407)
at sun.reflect.GeneratedMethodAccessor750.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:140)
at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:295)
at org.jboss.resteasy.core.ResourceMet
@c0mpiler
c0mpiler / pypi-release-checklist.md
Created July 13, 2018 01:18
My PyPI Release Checklist
  • Update HISTORY.rst
  • Commit the changes:
git add HISTORY.rst
git commit -m "Changelog for upcoming release 0.1.1."
  • Update version number (can also be minor or major)
bumpversion patch
@c0mpiler
c0mpiler / git-merge-strategies
Created September 25, 2018 01:56
(Because I always forget) How to overwrite a master branch with a remote branch
git checkout better_branch
git merge --strategy=ours master # keep the content of this branch, but record a merge
git checkout master
git merge better_branch # fast-forward master up to the merge
----------------------
If you want your history to be a little clearer, I'd recommend adding some information to the merge commit message to make it clear what you've done. Change the second line to: