Skip to content

Instantly share code, notes, and snippets.

@dodyg
dodyg / gist:5823184
Last active March 29, 2024 03:59
Kotlin Programming Language Cheat Sheet Part 1

#Intro

Kotlin is a new programming language for the JVM. It produces Java bytecode, supports Android and generates JavaScript. The latest version of the language is Kotlin M5.3

Kotlin project website is at kotlin.jetbrains.org.

All the codes here can be copied and run on Kotlin online editor.

Let's get started.

@jacksoncage
jacksoncage / jenkins-slave
Last active December 8, 2023 23:40
Bash script to check if a Jenkins slave node is offline and will restart node java process.
#!/bin/sh
#
# jenkins-slave: Launch a Jenkins BuildSlave instance on this node
#
# chkconfig: - 99 01
# description: Enable this node to fulfill build jobs
#
JENKINS_WORKDIR="/var/jenkins"
JENKINS_USER="jenkins"
@yageek
yageek / PieChart.java
Created July 15, 2013 19:56
Piechart in customview android code
/* Copyright (C) 2012 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
@jasonrudolph
jasonrudolph / 00-about-search-api-examples.md
Last active April 30, 2024 19:21
5 entertaining things you can find with the GitHub Search API
@ErikHellman
ErikHellman / PaintView.java
Created July 24, 2013 09:56
A very simple example of using multi-touch on Android to build a custom View for finger painting. This example uses the Path class from the android.graphics package. Feel free to use this code as you wish for your own multi-touch apps.
public class PaintView extends View {
public static final int MAX_FINGERS = 5;
private Path[] mFingerPaths = new Path[MAX_FINGERS];
private Paint mFingerPaint;
private ArrayList<Path> mCompletedPaths;
private RectF mPathBounds = new RectF();
public PaintView(Context context) {
super(context);
}
@mplewis
mplewis / flask-uwsgi-nginx-primer.md
Last active October 24, 2022 19:20
Flask + uWSGI + nginx Primer. I've been having trouble with serving a Flask app via uWSGI and nginx, so I thought I'd put together some of the basics to help out others.

Flask + uWSGI + nginx Primer

I've been having trouble with serving a Flask app via uWSGI and nginx, so I thought I'd put together some of the basics to help out others.

How this shit works

  • Flask is managed by uWSGI.
  • uWSGI talks to nginx.
@BrandonSmith
BrandonSmith / AndroidManifest.xml
Last active July 19, 2023 19:11
Quick example of how to schedule a notification in the future using AlarmManager
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.cards.notification">
<uses-sdk
android:minSdkVersion="17"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
@rpavlik
rpavlik / add-package-from-testing
Created October 21, 2013 17:08
Selectively adding packages from Debian Testing
#!/bin/bash
RELEASE=testing
PREFS=/etc/apt/preferences.d/debian-${RELEASE}
PRIORITY=300
# Set up two variables: one with the package names, and one with package
# names followed by /testing (for example)
PACKAGENAMES="$@"
for pkg in "$@"; do
@jordanbeck
jordanbeck / README.md
Last active December 31, 2015 01:38
Attempting to update versionName and versionCode for gradle buildTypes [and currently failing]

This currently does not work the way I want, but I want to document it for personal reference.

Scenario:

I have an app that uses a library project being build in parallel. I want to have three different build types: debug, internal, release. I want each of those to have it's own package name, app name, version number, and version code. I want to be able to at least automate a build for internal on a nightly basis and upload to HockeyApp.

Problems:

  • First problem I ran into was that buildTypes in gradle do not allow you to specify versionNumber or versionCode. Just suffixes for those properties. So I moved to flavors...
  • Unfortunately, I'm using BuildConfig and with flavors, BuildConfig.java is not found by Android Studios. Everything does work this way (I can run gradle commands from the command line just fine), but without my IDE, it's kind of hard to work. Also, a downside to this approach is that it produces too many apks. If I have the three desired build types and have to have three flavors,
@larrybotha
larrybotha / A.markdown
Last active October 24, 2023 21:26
Merge wiki updates that are on a fork of your repo.

Merge Wiki Changes From A Forked Github Repo

This is inspired (or basically copied) from How To Merge Github Wiki Changes From One Repository To Another, by Roman Ivanov, and serves to ensure that should something happen to the original article, the information remains nice and safe here.

Terminology

OREPO: original repo - the repo created or maintained by the owner

FREPO: the forked repo that presumably has updates to its wiki, not yet on the OREPO