Skip to content

Instantly share code, notes, and snippets.

View danikx's full-sized avatar

Daniyar Kalmurzin danikx

View GitHub Profile
@danikx
danikx / ScrollingActivity.java
Created May 26, 2018 14:57 — forked from iChintanSoni/ScrollingActivity.java
CollapsingToolbarLayout with TabLayout
public class ScrollingActivity extends AppCompatActivity {
private SectionsPagerAdapter mSectionsPagerAdapter;
private ViewPager mViewPager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_scrolling);
#!/bin/bash
# atlassian-heap-dump.sh - dump a heap using GDB for a crashed application
# Accepts a single argument: the PID of the JVM
# Author: James Gray ([email protected])
# Copyright Atlassian P/L
# License: MIT
# Are we root?
if [ $UID -ne 0 ]; then
#!/bin/sh
# Oneliner by @Coornail, modifications by @ErikBjare
watch -n1 -d "curl -s https://btc-e.com/api/2/btc_usd/ticker | json_pp | tail --line=+2 | head --line=12"
#!/bin/sh
# Requires jq
# Remember to chmod +x!
#
# Add the following cron-job (using "crontab -e") to run at hourly intervals:
# 0 * * * * export DISPLAY=:0.0 && /bin/bash <SCRIPT_PATH_GOES_HERE> > /dev/null 2>&1
# Change <SCRIPT_PATH_GOES_HERE> to the appropriate name
BTCE_PRICE="$(curl -s https://btc-e.com/api/2/btc_usd/ticker | jq '.ticker.last')"
/**
* The following snippets shows how to set a custom endpoint for a JAX-WS generated WebClient on runtime
*/
// Get the service and the port
SampleService service = new SampleService();
Sample port = service.getESamplePort();
// Use the BindingProvider's context to set the endpoint
BindingProvider bp = (BindingProvider)port;
@danikx
danikx / gist:6622070
Created September 19, 2013 11:27 — forked from HashNuke/gist:608259
# to undo a git push
git push -f origin HEAD^:master
# to get to previous commit (preserves working tree)
git reset --soft HEAD
# to get back to previous commit (you'll lose working tree)
git reset --hard HEAD^
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;