Skip to content

Instantly share code, notes, and snippets.

@salyh
salyh / gist:d63a4828364f3313837f12939a3b57a4
Created January 18, 2024 10:18
git: squash all commits in the current branch
git reset --soft HEAD~$(( $(git rev-list --count $(git rev-parse --abbrev-ref HEAD)) -1 )) && git commit -m "Initial commit"
@salyh
salyh / install_docker_github_runner_ubuntu.sh
Last active January 18, 2024 10:18
Install a self-hosted github runner on ubuntu arm64 or x64 with docker
#!/bin/bash
# Install a self-hosted github runner on ubuntu arm64 or x64 with docker
# This runner can only execute one job concurrently. This is a general limitation of self-hosted github runner.
# Do not run multiple github runners on one machine, this cause race conditions. Use more (virtual-) machines.
# This script uses svc.sh to install the runner as systemd daemon which is automatically stared when the machine reboots.
# The runner gets the label "linux-$ARCH" (and no further default labels) and a default name (which is typically the host name).
# You can also run this script via ssh, without copying, from another machine via:
# cat install_docker_github_runner_ubuntu.sh | ssh root@xxx.xxx.xxx.xxx
@salyh
salyh / gist:b5af4648ff04930ccca0
Created March 25, 2016 15:03
Install elasticsearch curator on SLES 11
sudo zypper install python-pip
wget https://pypi.python.org/packages/source/u/urllib3/urllib3-1.12.tar.gz
sudo pip install urllib3-1.12.tar.gz
wget https://pypi.python.org/packages/source/c/click/click-6.2.tar.gz -O click-6.3.tar.gz
sudo pip install click-6.3.tar.gz
wget http://voidspace.org.uk/downloads/unittest2-0.5.1-python2.3.zip
sudo pip install unittest2-0.5.1-python2.3.zip
sudo wget https://github.com/elastic/elasticsearch-py/archive/2.3.0.tar.gz -O elasticsearch-py.tar.gz
sudo pip install elasticsearch-py.tar.gz
wget https://github.com/elastic/curator/archive/v3.5.1.tar.gz -O elasticsearch-curator.tar.gz
@salyh
salyh / CompressedOopsChecker.java
Created July 15, 2015 16:56
CompressedOopsChecker - check if compressed oops are enabled/disabled on your JVM
//derived from lucene
//ASL2 License
import java.lang.reflect.Method;
public class CompressedOopsChecker {
private static final String OS_ARCH = System.getProperty("os.arch");
public static final boolean JRE_IS_64BIT_HOTSPOT;
public final static boolean COMPRESSED_REFS_ENABLED;
private static final String MANAGEMENT_FACTORY_CLASS = "java.lang.management.ManagementFactory";
@salyh
salyh / gist:5ad9dc3a36b5bda27e14
Created April 2, 2015 10:12
thread group enumeration
package testthread;
import java.util.concurrent.CountDownLatch;
public class Main {
public static void main(String[] args) throws InterruptedException {
final int size = 3;
### Keybase proof
I hereby claim:
* I am salyh on github.
* I am salyh (https://keybase.io/salyh) on keybase.
* I have a public key whose fingerprint is EAB9 F6D2 F68F 1AD9 1138 7CA1 88F3 CF4C 22D7 F6EC
To claim this, I am signing this object: