Skip to content

Instantly share code, notes, and snippets.

@a-v-ebrahimi
a-v-ebrahimi / yaml_3_containers.yaml
Last active September 4, 2017 13:57
Sample Yaml 2
apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
name: {{ template "fullname" . }}
namespace: "{{ .Values.namespace }}"
labels:
chart: "chartNameVersion"
spec:
serviceName: {{ template "fullname" . }}
replicas: {{ .Values.replicaCount }}
@a-v-ebrahimi
a-v-ebrahimi / sample.yaml
Created September 4, 2017 11:03
sample YAML
apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
name: {{ template "fullname" . }}
namespace: "{{ .Values.namespace }}"
labels:
chart: "chartNameVersion"
spec:
serviceName: {{ template "fullname" . }}
replicas: {{ .Values.replicaCount }}
@a-v-ebrahimi
a-v-ebrahimi / file.yaml
Last active September 4, 2017 08:37
test
hello
@a-v-ebrahimi
a-v-ebrahimi / add_aar_to_gradle
Created March 23, 2016 05:28
Add AAR Library to build.gradle
allprojects {
repositories {
jcenter()
flatDir {
dirs 'libs'
}
}
}
dependencies {
@a-v-ebrahimi
a-v-ebrahimi / Android APK Name
Created March 21, 2016 06:25
Android APK Name
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.company.app"
minSdkVersion 13
targetSdkVersion 21
versionCode 14 // increment with every release
versionName '1.4.8' // change with every release
setProperty("archivesBaseName", "MyCompany-MyAppName-$versionName")
@a-v-ebrahimi
a-v-ebrahimi / center_align_vertically.css
Created February 11, 2016 06:16
Center align a block vertically in CSS
.center-align-vertically {
position: absolute;
top: 50%;
transform: translateY(-50%);
}
@a-v-ebrahimi
a-v-ebrahimi / copypath
Created August 5, 2015 11:42
Copy path to clipboard (Automator)
on run {input, parameters} try
tell application "Finder" to set the clipboard to POSIX path of (target of window 1 as alias)
on error
beep
end try return input end run
@a-v-ebrahimi
a-v-ebrahimi / gradle_apk_name
Last active August 29, 2015 14:25
Android Gradle APK name
buildTypes {
release {
//...
applicationVariants.all { variant ->
variant.outputs.each { output ->
output.outputFile = new File(
output.outputFile.parent,
output.outputFile.name.replace("app-release.apk", "YOURAPPNAME-${variant.versionName}.apk"))
}
}
@a-v-ebrahimi
a-v-ebrahimi / gist:283c723b7eae8b42730e
Created February 9, 2015 07:46
Convert LinkedTreeMap key-value pair into JSON
public static JSONObject convertKeyValueToJSON(LinkedTreeMap<String, Object> ltm) {
JSONObject jo=new JSONObject();
Object[] objs = ltm.entrySet().toArray();
for (int l=0;l<objs.length;l++)
{
Map.Entry o= (Map.Entry) objs[l];
try {
if (o.getValue() instanceof LinkedTreeMap)
jo.put(o.getKey().toString(),convertKeyValueToJSON((LinkedTreeMap<String, Object>) o.getValue()));
else
@a-v-ebrahimi
a-v-ebrahimi / gist:22b55e9eb8087c9c85d1
Created September 1, 2014 05:00
Check if user is elevated (UAC)
// copied from :
// http://stackoverflow.com/a/17492949/305135
public static class UacHelper
{
private const string uacRegistryKey = "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System";
private const string uacRegistryValue = "EnableLUA";
private static uint STANDARD_RIGHTS_READ = 0x00020000;
private static uint TOKEN_QUERY = 0x0008;