Skip to content

Instantly share code, notes, and snippets.

View imyousuf's full-sized avatar

Imran M Yousuf imyousuf

View GitHub Profile
@imyousuf
imyousuf / config.toml
Last active December 31, 2019 22:31
Hugo - Tags HTML mismatch with its XML
archetypeDir = "archetypes"
author = "Imran M Yousuf"
baseUrl = "https://imytech.net"
buildDrafts = true
relativeURLs = true
canonifyUrls = true
contentDir = "content"
languageCode = "en-us"
layoutDir = "layouts"
publishDir = "public"
@imyousuf
imyousuf / main.go
Created July 18, 2019 21:46
A crack at the code cleaner problem
package main
import (
"bufio"
"fmt"
"os"
"sort"
"strings"
"unicode"
)
$.phoneNumbers[?(@.type=='home')].number
$.firstName
@imyousuf
imyousuf / up-dev-system.sh
Last active March 18, 2018 09:34
A script to setup and start the docker container for local development
#!/bin/sh
set -e
set -x
make setup-docker-dev
(cd web/img-mngr/ && au build --watch > /dev/null &)
go install
(cd dist/ && fs-image-manager )
@imyousuf
imyousuf / install-fs-image-manager
Last active November 2, 2020 19:58
Add nohup when spawning the process
#!/bin/sh
latest_release=$(curl "https://api.github.com/repos/imyousuf/fs-image-manager/releases/latest" -H "Accept: application/json" -L)
(
mkdir -p dist/
cd dist/
version=$(echo "$latest_release" | grep "tag_name" | cut -d '"' -f 4)
fe="false"
test -f version.txt && fe="true"
test -f fs-image-manager.pid && kill -2 $(cat fs-image-manager.pid) && echo "Existing fs-image-manager shutdown"
download_new="true"
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
/**
* Copyright 2009 The Apache Software Foundation
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
#!/bin/sh
HUDSON_WORK_DIR=/home/hudson/.hudson/
BACKUP_DIR=/home/smartadmin/hudson/backup/
files_to_copy=$(find "$HUDSON_WORK_DIR" | grep -v "^\(.*/\(workspace\|builds\|modules\)/.*\)")
(
stamp=$(date +%Y-%m-%d'T'%H:%M:%S%z)
current_bk_dir="$BACKUP_DIR"
mkdir -p "$current_bk_dir"
cd "$current_bk_dir" || exit 1
test -d .git || git init
ByteBuffer buffer = ByteBuffer.allocate(testData.length);
ByteBuffer tmp = buffer;
LinkedHashMap<ByteBuffer, MutableInt> map = new LinkedHashMap<ByteBuffer, MutableInt>();
map.put(tmp, new MutableInt());
tmp.put(testData); // Right after this operation hashCode changes but the buffer is equal
assertTrue(buffer.equals(tmp));
assertNull(map.get(buffer));
import java.io.IOException;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HColumnDescriptor;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.client.Get;
import org.apache.hadoop.hbase.client.HBaseAdmin;
import org.apache.hadoop.hbase.client.HConnection;
import org.apache.hadoop.hbase.client.HConnectionManager;
import org.apache.hadoop.hbase.client.HTable;
import org.apache.hadoop.hbase.client.Put;
[ivy:resolve] :: resolution report :: resolve 1241ms :: artifacts dl 36ms
---------------------------------------------------------------------
| | modules || artifacts |
| conf | number| search|dwnlded|evicted|| number|dwnlded|
---------------------------------------------------------------------
| ant | 3 | 0 | 0 | 0 || 3 | 0 |
| eclipse | 1 | 0 | 0 | 0 || 1 | 0 |
| compile | 17 | 0 | 0 | 0 || 17 | 0 |
| test | 21 | 0 | 0 | 0 || 21 | 0 |
| instrument | 7 | 0 | 0 | 0 || 7 | 0 |