Skip to content

Instantly share code, notes, and snippets.

Avatar

Mike Kotsur mkotsur

View GitHub Profile
@mkotsur
mkotsur / keynote-to-pdf.scpt
Last active Apr 3, 2020
A useful AppleScript snipped that makes a PDF snapshot of your active Keynote presentation without annoying menu clicking
View keynote-to-pdf.scpt
#!/usr/bin/osascript
-- Make sure to update the `pdfPath` variable!
local pdfPath
set pdfPath to "Projects:conf-2020-scalaua:Prototyping-The-Future-ScalaUA-2020.pdf"
local destPath
set destPath to ((path to home folder) as text) & pdfPath
View chainWear.js
let mileage = 0
const defaultLinkPitch = 10 // milimeters
let cogHealth = 100 // %
const chainCycle = () => {
mileage += 0.000001
const linkPitch = mileage * 2.5
View ScalaHandler.scala
package hello
import io.circe.generic.auto._
import io.github.mkotsur.aws.handler.Lambda._
import io.github.mkotsur.aws.handler.Lambda
import com.amazonaws.services.lambda.runtime.Context
import io.github.mkotsur.aws.proxy
import io.github.mkotsur.aws.proxy.ProxyResponse
import ScalaHandler._
View ApiGatewayResponse.scala
package hello
import scala.beans.BeanProperty
case class ApiGatewayResponse(@BeanProperty statusCode: Integer, @BeanProperty body: String,
@BeanProperty headers: java.util.Map[String, Object], @BeanProperty base64Encoded: Boolean = false)
@mkotsur
mkotsur / MergesortFiles.java
Created Dec 11, 2015
MergeSort implementation
View MergesortFiles.java
import java.io.*;
public class MergesortFiles {
public static void main(String[] bla) throws Exception {
final int MAX_READ_STEP = 15;
final File f1 = new File("/tmp/test.txt");
final File f2 = new File("/tmp/test2.txt");
@mkotsur
mkotsur / init.pp
Created Aug 2, 2012
Creating user with password in puppet [works]
View init.pp
class test {
Exec { path => [ "/bin/", "/sbin/" , "/usr/bin/", "/usr/sbin/" ] }
exec { 'uuu':
command => 'sudo useradd -p \'$6$ho0rkgYB$tWX9tiduG4orUmc6Z6hfaha5C4v5xCzK.Xa1d2mSBRW5TwzkgeWap2tUuiEdUQBfo3KnvQi/Y1XjesFFZrMBj1\' myuser'
}
}
@mkotsur
mkotsur / Coords.java
Created Dec 31, 2011
Simple tool for determining cursor coordinates
View Coords.java
import java.awt.MouseInfo;
import java.awt.Point;
public class Coords {
public static void main(String args[]) throws Exception {
while (true) {
Point spot = MouseInfo.getPointerInfo().getLocation();
System.out.println(String.valueOf(spot.getX()) + "," + String.valueOf(spot.getY()));
Thread.sleep(10);
}
@mkotsur
mkotsur / gist:1312061
Created Oct 25, 2011
Stubborn command
View gist:1312061
r=1; while test "$r" != "0"; do mysql -h 33.33.33.100 -uroot -proot123 dbase; r=$?; sleep 1; done;
@mkotsur
mkotsur / out.log
Created Sep 13, 2011
brew install glib failed
View out.log
ip212-238-53-50:~ mkotsur$ brew doctor
fatal: '/usr/local/Library/Homebrew' is outside repository
Your system is raring to brew.
ip212-238-53-50:~ mkotsur$ brew install glib
==> Downloading ftp://ftp.gnome.org/pub/gnome/sources/glib/2.28/glib-2.28.8.tar.bz2
File already downloaded in /Users/mkotsur/Library/Caches/Homebrew
==> Downloading patches
######################################################################## 100.0%
######################################################################## 100.0%
######################################################################## 100.0%
View ProductsResource.java
@Path("/productservice")
@Produces("application/json")
public class ProductsResource extends AbstractResource {
@POST
@Path("/")
@Consumes("application/json")
public String postString(
@Context HttpServletRequest req,
@Context HttpServletResponse res,
You can’t perform that action at this time.