Skip to content

Instantly share code, notes, and snippets.

@nowke
nowke / bresenham.cpp
Last active April 3, 2023 00:49
Bresenham Line Drawing - OpenGL
#include <gl/glut.h>
#include <stdio.h>
int x1, y1, x2, y2;
void myInit() {
glClear(GL_COLOR_BUFFER_BIT);
glClearColor(0.0, 0.0, 0.0, 1.0);
glMatrixMode(GL_PROJECTION);
gluOrtho2D(0, 500, 0, 500);
@nowke
nowke / rotate.sh
Last active May 19, 2016 13:47
Shell script manipulation - Collection
#!/bin/bash
for file in ~/Pictures/Lex/*.png; do
convert "$file" -rotate 270 "${file%.png}"_rotated.png
done
@nowke
nowke / MainActivity.java
Last active November 30, 2022 11:42
Retrofit - OkHTTP Connect to Self signed SSL Enabled Server: (Fix for CertPathValidatorException: Trust Anchor for certificate path not found) - Self Signing Client Bulider for Retrofit OkHTTP
public class MainActivity extends AppCompatActivity {
Retrofit retrofit;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
/*
Rest
*/
@nowke
nowke / DetailActivity.java
Created September 26, 2015 07:46
Final DetailActivity.java - with parallax image scroll
package in.nowke.appbarmiddlelayout;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.ViewTreeObserver;
import android.widget.ImageView;
@nowke
nowke / activity_detail.xml
Created September 26, 2015 07:41
Detail Activity layout - Sticky scroll view
<com.emilsjolander.components.StickyScrollViewItems.StickyScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/scrollView"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
@nowke
nowke / DetailActivity.java
Last active September 26, 2015 07:28
Detail Activity - with ScrollView
package in.nowke.appbarmiddlelayout;
import android.os.Build;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
@nowke
nowke / activity_detail.xml
Last active September 26, 2015 07:24
Detail Activity layout - with ScrollView
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="150dp"
android:background="@color/colorPrimary"
android:fitsSystemWindows="true"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
package in.nowke.appbarmiddlelayout;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;