Skip to content

Instantly share code, notes, and snippets.

View beothorn's full-sized avatar

Beothorn beothorn

View GitHub Profile
--SELECT
-- *
--FROM
-- crime_scene_report
--WHERE
-- date = 20180115
-- AND city = 'SQL City'
-- AND type = 'murder'
--Security footage shows that there were 2 witnesses. The first witness
--lives at the last house on "Northwestern Dr". The second witness, named
var next = (numberString) =>{
const count = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
for(c of numberString){
count[parseInt(c)]++
}
let nextString = ""
for(c of numberString){
if(count[parseInt(c)] > 0){
nextString += count[parseInt(c)] + c
count[parseInt(c)] = 0
@beothorn
beothorn / seq.js
Last active May 28, 2020 15:36
playing around a joke sequence
var next = (numberString) =>{
const count = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
for(c of numberString){
count[parseInt(c)]++
}
let nextString = ""
for(c of numberString){
if(count[parseInt(c)] > 0){
nextString += count[parseInt(c)] + c
count[parseInt(c)] = 0
@beothorn
beothorn / awslambda
Created November 19, 2019 21:56
lambda request ec2
import boto3
import datetime
import os
import json
def test_instance(ec2_client):
ec2_client.request_spot_instances(
DryRun=False,
SpotPrice='0.02',
ClientToken='string',
@beothorn
beothorn / .spacemacs
Created January 24, 2018 19:10
Configuring cygwin find/grep on windows for spacemacs
;;Using cygwin
(setq find-program "\"C:/cygwin64/bin/find.exe\"")
(setq grep-program "\"C:/cygwin64/bin/grep.exe\"")
;; Prevent issues with the Windows null device (NUL)
;; when using cygwin find with rgrep.
(defadvice grep-compute-defaults (around grep-compute-defaults-advice-null-device)
"Use cygwin's /dev/null as the null-device."
(let ((null-device "/dev/null"))
ad-do-it))
(ad-activate 'grep-compute-defaults)
@beothorn
beothorn / enhanceShadows.py
Created January 20, 2018 18:43
Enhances shadows from given image args: original destination brightness
from PIL import Image, ImageFilter, ImageChops, ImageEnhance
import sys
original_img = sys.argv[1]
dest_img = sys.argv[2]
mask_strength = sys.argv[3]
original = Image.open(original_img)
gray = original.convert("LA")
blurred = gray.filter(ImageFilter.GaussianBlur(radius=5))
@beothorn
beothorn / renderAndroidAssets.sh
Created January 17, 2018 18:02
Render a .blend file in all sizes needed for android
if [ -z "$1" ]
then
echo ".blend logo file as argument"
fi
blender -b $1 -S XXXHDPI -o //mipmap-xxxhdpi/ -a -S XXHDPI -o //mipmap-xxhdpi/ -a -S XHDPI -o //mipmap-xhdpi/ -a -S HDPI -o //mipmap-hdpi/ -a -S MDPI -o //mipmap-mdpi/ -a
mv ./mipmap-xxxhdpi/0001.png ./mipmap-xxxhdpi/ic_launcher.png
cp ./mipmap-xxxhdpi/ic_launcher.png ./mipmap-xxxhdpi/ic_launcher_round.png
mv ./mipmap-xxhdpi/0001.png ./mipmap-xxhdpi/ic_launcher.png
cp ./mipmap-xxhdpi/ic_launcher.png ./mipmap-xxhdpi/ic_launcher_round.png
@beothorn
beothorn / objectToJava.py
Last active August 29, 2015 14:21
This is a blender script to convert an object to a literal java array
import bpy
'''
This is a blender script to convert an object to a literal java array
'''
result = "static float coords[] = {\n"
current_obj = bpy.context.active_object
package webGrude;
import webGrude.annotations.Page;
import webGrude.annotations.Selector;
import java.util.List;
public class PirateBayExample {
@Page("http://thepiratebay.se/search/{0}/0/7/0")
import webGrude.annotations.Page;
import webGrude.annotations.Selector;
import java.util.List;
public class PrintExampleSearchResults {
@Selector("")
public static class SearchResult{
@Selector(".result-title") public String resultTitle;