Skip to content

Instantly share code, notes, and snippets.

View GlennReilly's full-sized avatar

Glenn Reilly GlennReilly

  • Sydney, Australia
View GitHub Profile
@GlennReilly
GlennReilly / clean.sh
Created June 17, 2020 10:07 — forked from Iman/clean.sh
Free up disk space on Ubuntu - clean log, cache, archive packages/apt archives, orphaned packages, old kernel and remove the trash
#!/bin/sh
#Check the Drive Space Used by Cached Files
du -sh /var/cache/apt/archives
#Clean all the log file
#for logs in `find /var/log -type f`; do > $logs; done
logs=`find /var/log -type f`
for i in $logs

Keybase proof

I hereby claim:

  • I am glennreilly on github.
  • I am glennreilly (https://keybase.io/glennreilly) on keybase.
  • I have a public key ASB5CKumFBuyaxsQPfarNSf-iDtGt9C_uCn30TOJy4w5Xwo

To claim this, I am signing this object:

@GlennReilly
GlennReilly / Metronome.java
Created May 24, 2018 01:30 — forked from tkojitu/Metronome.java
Metronome with javax.sound.midi.Sequencer
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.sound.midi.*;
public class Metronome implements MetaEventListener {
private Sequencer sequencer;
private int bpm;
public void start(int bpm) {
try {
fun isAscending(list: List<Int>):Boolean {
return list.let {
var tempResult = true
it.forEachIndexed { idx, item ->
tempResult = if (idx != it.lastIndex) item < it[idx + 1] else true
if (!tempResult) return@let tempResult
}
tempResult
}
}
All these functions are used for switching the scope of the current function / the variable. They are used to keep things that belong together in one place (mostly initializations).
Here are some examples:
run - returns anything you want and re-scopes the variable it's used on to this
val password: Password = PasswordGenerator().run {
seed = "someString"
hash = {s -> someHash(s)}
hashRepetitions = 1000
@GlennReilly
GlennReilly / renoise.md
Created November 26, 2017 10:11 — forked from pezz/renoise.md
How to use Renoise on a system without f*#$ing it over and doing your head in
import java.time.Duration
import java.time.LocalDateTime
import java.time.Month
import java.time.Period
import java.time.temporal.TemporalUnit
import java.util.*
import javax.xml.datatype.DatatypeConstants.MINUTES
val startDate: LocalDateTime = LocalDateTime.of(2017,Month.NOVEMBER,25,16,30)
val endDate: LocalDateTime = LocalDateTime.now()
import io.reactivex.Observable
import io.reactivex.ObservableEmitter
import io.reactivex.disposables.Disposable
import io.reactivex.functions.BiFunction
import io.reactivex.observables.GroupedObservable
import io.reactivex.schedulers.Schedulers
import java.util.*
import java.util.concurrent.TimeUnit
@GlennReilly
GlennReilly / A better git log
Last active October 18, 2017 03:35
A better git log
https://coderwall.com/p/euwpig/a-better-git-log
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
git lg
eXtreme Go Horse (XGH) Process
Source: http://gohorseprocess.wordpress.com
1. I think therefore it's not XGH.
In XGH you don't think, you do the first thing that comes to your mind. There's not a second option as the first one is faster.
2. There are 3 ways of solving a problem: the right way, the wrong way and the XGH way which is exactly like the first one but faster.
XGH is faster than any development process you know (see Axiom 14).