Skip to content

Instantly share code, notes, and snippets.

@kkruups
kkruups / WomenDay.txt
Created March 7, 2019 21:54
Google: WomenDay
Google logo
@kkruups
kkruups / tokyo_crime_stats_utf8.csv
Last active January 17, 2019 03:48
Tokyo Crime Stats: CSV file (Ota-Ku)
We can make this file beautiful and searchable if this error is corrected: It looks like row 6 should actually have 41 columns, instead of 38. in line 5.
address,lat,lon,total,serious_crime,robbery,other,violent_crime,armed_perps,Assault,injury,intimidation,Extortion,theft_by_home_invasion,safe_cracking,School_Violence,Office_Violence,Store_Opening_Violence,empty_house_robbery,Stealth_Robbery,Illegal_Occupancy,other,Non-invasive_Robbery,Car_Theft,motorcycle_theft,bicycle_theft,property_theft_from_car,Vending_Machine_Theft,construction_site_theft,pick_pocketing,hit_n_run,property_theft,shoplifting,other,other_totals,scam,embezzlement,con_artist_crimes,gambling_crive,other_penal_code_offenses,Year
千代田区外神田5丁目,0,0,9,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,7,0,0,4,1,0,0,1,0,0,0,1,1,0,1,0,0,0,2018
千代田区外神田6丁目,0,0,21,0,0,0,0,0,0,0,0,0,2,0,0,0,2,0,0,0,0,11,0,0,1,0,0,1,0,0,1,4,4,8,6,1,0,0,1,2018
千代田区鍛冶町1丁目,0,0,21,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,16,0,0,1,0,0,0,0,0,1,3,11,4,0,1,0,0,3,2018
千代田区鍛冶町2丁目,0,0,77,0,0,0,6,0,4,2,0,0,8,0,0,1,5,0,0,0,2,51,0,0,9,0,0,0,5,0,7,4,26,12,2,5,0,0,5,2018
千代田区神田鍛冶町3丁目,0,0,16,0,0,0,0,0,0,0,0,0,10,0,0,8,0,0,0,0,2,6,0,0,1,0,0,0,0,0,0,2,3,0,0,0,0
@kkruups
kkruups / radar.r
Created December 19, 2018 00:31
R; R Radar Gist
# Create data: note in High school for Jonathan:
set.seed(1)
data <-as.data.frame(matrix( sample( 2:20 , 60 , replace=T) , ncol=10, byrow=TRUE))
colnames(data) <- c("math" , "english" , "biology" , "music" , "R-coding", "data-viz" , "french" , "physic", "statistic", "sport" )
# To use the fmsb package, I have to add 2 lines to the dataframe: the max and min of each topic to show on the plot!
data <-rbind(rep(20,10) , rep(0,10) , data)
# Prepare color
colors_border=colormap(colormap=colormaps$viridis, nshades=6, alpha=1)
@kkruups
kkruups / test.py
Last active July 19, 2018 00:28
Colab: Image Source test
#Use MD img tag in Colab as below to display images located a Githubgist
![img](https://user-images.githubusercontent.com/1913254/42914453-6827f23c-8b35-11e8-990c-333e76ba15f4.png)
@kkruups
kkruups / aabb_algorithm.txt
Created July 27, 2017 01:36
AABB Algorithm : Axis Aligned Bounded Box -- For determining 2D Collisions
AABB Algorithm : Axis Aligned Bounded Box -- For determining 2D Collisions
@kkruups
kkruups / elm_insights_farewell_backticks_hello_pipeline.elm
Created November 22, 2016 06:59
Elm Insights: Article on Pipelining
{-
To run in elmO (elm Online Editor): copy n paste into http://elm-lang.org/try
New andThen Pipeline Pattern, replaces `andThen` infix operation
introduced in v0.18 to
Result.andThen
Maybe.andThen
Json.Decode.andThen
Task.andThen
@kkruups
kkruups / elm_pipeline_userlistdecode.elm
Last active November 20, 2016 07:12
Elm: Medium post (Response to Comment): Elm Insight How the elm JSON API, Elm-Decode-Pipeline and Json.Decode API Work
{--
Medium post (Response to Comment):
Updated to show how to extract a nested User type from a List of User in a Json String
See userListDecode function for details
Copy-n-Paste this code into Elm Online Editor to see run:
http://elm-lang.org/try
Updated to reflect changes in elm release version 0.18
field replaces (:=)
mapN replace objectN functions
@kkruups
kkruups / elm_insight_json_decode_n_pipeline.elm
Last active November 17, 2016 06:34
Elm: Medium post: Elm Insight A Road to a Better Understanding: How the elm JSON API, Elm-Decode-Pipeline and Json.Decode API Work
{--
Copy-n-Paste this code into Elm Online Editor to see run:
http://elm-lang.org/try
Updated to reflect changes in elm release version 0.18
field replaces (:=)
mapN replace objectN functions
All code except data blob -- jsonBlob is written by author (@Brian Hichs mention below)
--}
import Html exposing (text, div, span)
@kkruups
kkruups / elm_decimaltoHexRGB_converter.elm
Created November 2, 2016 04:38
Elm: My Custom Elm Decimal to Hex Converter for CSS 6 digit RGB Colors
import Html exposing (text, div)
import Html.Attributes as Attributes exposing(style)
import List
import Array
import String
getValue: Int -> Array.Array Char -> Char
getValue =
(\idx array ->
(Maybe.withDefault '?' (Array.get idx array)))
@kkruups
kkruups / getpath_error_executing_str.R
Created May 19, 2016 07:15
Rscript: RNeo4j getPath return values indicate file.info(x) error
Sys.setenv(LANG = "en")
library(RNeo4j)
library(httr)
#Sys.getlocale()
#Sys.setlocale(categories = "LC_ALL" , locale = "Japanese_Japan.932" )
#Sys.setlocale( locale = "en_utf8" )
#Sys.setenv(LANG = "en")