Skip to content

Instantly share code, notes, and snippets.

💭
looking for new opportunities - let's have them!

Karol Bucek kares

💭
looking for new opportunities - let's have them!
Block or report user

Report or block kares

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@rtyler
rtyler / build.gradle
Created May 25, 2019
A quick example pre-compiling JRuby before stuffing it into a .jar file.
View build.gradle
plugins {
id 'java'
id "com.github.jruby-gradle.base" version "1.7.0"
id "com.github.jruby-gradle.jar" version "1.7.0"
}
import com.github.jrubygradle.JRubyExec
dependencies {
jrubyJar "rubygems:state_machines:0.5.0"
@ummjackson
ummjackson / xrpaway.py
Last active Feb 19, 2019
XRP Away™️ - automatically block XRP fanatics sliding into your Twitter mentions
View xrpaway.py
# Requirement: pip install tweepy
import tweepy
# Credentials go here (generate at: https://apps.twitter.com)
auth = tweepy.OAuthHandler('consumer_key', 'consumer_secret')
auth.set_access_token('access_token', 'access_token_secret')
# Connect to Twitter
api = tweepy.API(auth)
@SFEley
SFEley / LambdaHandler.java
Created Oct 22, 2018
LambdaHandler.java
View LambdaHandler.java
import java.util.List;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.nio.file.Paths;
import com.amazonaws.services.lambda.runtime.RequestStreamHandler;
import com.amazonaws.services.lambda.runtime.Context;
@LeZuse
LeZuse / stats_logger.rb
Last active Mar 26, 2019
Puma plugin for stats logging on Heroku
View stats_logger.rb
Puma::Plugin.create do
def production?
ENV.fetch('RACK_ENV', 'development') == 'production'
end
def log(msg)
if production?
Rails.logger.info msg
else
puts msg
@eginez
eginez / kotlinNativeGraal.md
Created May 8, 2018
Compile kotlin code to a native executable
View kotlinNativeGraal.md

You need to first install GraalVM, and then set your PATH so that you get the GraalVM binaries

Then you need the kotlin compiler toolchain. Easiest with sdkman Create a Kotlin file and add a simple program

$> cat src/main.kt
fun main() {
    println("hello")
}
@jamescmartinez
jamescmartinez / ruby-on-raspbian.md
Last active Nov 8, 2018
Script to Install Latest Ruby on Raspberry Pi (Raspbian)
View ruby-on-raspbian.md
# Install asdf, our Ruby version manager
git clone https://github.com/asdf-vm/asdf.git ~/.asdf
echo -e '\n. $HOME/.asdf/asdf.sh' >> ~/.bashrc
echo -e '\n. $HOME/.asdf/completions/asdf.bash' >> ~/.bashrc

# Install dependencies (source: https://github.com/asdf-vm/asdf/blob/master/README.md)
sudo apt-get update
sudo apt-get install automake autoconf libreadline-dev libncurses-dev libssl-dev libyaml-dev libxslt-dev libffi-dev libtool unixodbc-dev
@headius
headius / Hello.java
Last active Jan 19, 2018
"Hello, %s" using method handles two different ways
View Hello.java
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
public class Hello {
private static final MethodHandles.Lookup lookup = MethodHandles.lookup();
public static void main(String[] args) throws Throwable {
System.out.println("Hello, " + args[0]);
}
@headius
headius / gist:2a8de5eb6adb115acb4649b698e2f6d3
Created Feb 1, 2017
mandelbrot(750) on JRuby with and without a tweaked Graal
View gist:2a8de5eb6adb115acb4649b698e2f6d3
~/projects/graal-core $ jruby -v mandelbrot.rb
jruby 9.1.8.0-SNAPSHOT (2.3.1) 2017-01-25 2b97d78 Java HotSpot(TM) 64-Bit Server VM 9-ea+152 on 9-ea+152 +indy +jit [linux-x86_64]
1.4988730000000001
0.875144
0.6610520000000001
0.666915
0.67083
0.658069
0.6749970000000001
0.667617
@headius
headius / 0.soft_ordering.diff
Last active Sep 6, 2016
Four impls of thread-safe Array#at for JRuby
View 0.soft_ordering.diff
diff --git a/core/src/main/java/org/jruby/RubyArray.java b/core/src/main/java/org/jruby/RubyArray.java
index 04fbeef..1c32bb39 100644
--- a/core/src/main/java/org/jruby/RubyArray.java
+++ b/core/src/main/java/org/jruby/RubyArray.java
@@ -71,6 +71,7 @@ import org.jruby.util.io.EncodingUtils;
import java.io.IOException;
import java.lang.reflect.Array;
+import java.lang.reflect.Field;
import java.util.Arrays;
View JceSecurity.java
private static void setupJurisdictionPolicies() throws Exception {
String javaHomeDir = System.getProperty("java.home");
String sep = File.separator;
String pathToPolicyJar = javaHomeDir + sep + "lib" + sep +
"security" + sep;
File exportJar = new File(pathToPolicyJar, "US_export_policy.jar");
File importJar = new File(pathToPolicyJar, "local_policy.jar");
URL jceCipherURL = ClassLoader.getSystemResource
("javax/crypto/Cipher.class");
You can’t perform that action at this time.