Skip to content

Instantly share code, notes, and snippets.

View elrikdante's full-sized avatar

Dante Haskell Elrik elrikdante

View GitHub Profile
@RickWong
RickWong / react.html
Last active April 20, 2021 15:48
Write React apps in 1 HTML file.
<html>
<body>
<div id="react-root"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-with-addons.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/redux/3.5.2/redux.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.7.7/babel.min.js"></script>
<script id="react-app" type="text/template">
const App = ({name}) => {
@mjul
mjul / fizzbuzz.fsx
Created April 6, 2016 09:11
FizzBuzz F#
// F# FizzBuzz using Active Patterns
let (|DivisibleBy|_|) by n =
match n%by with
| 0 -> Some DivisibleBy
| _ -> None
let fizzbuzz = function
| DivisibleBy 3 & DivisibleBy 5 -> "FizzBuzz"
| DivisibleBy 3 -> "Fizz"
@dela3499
dela3499 / blockchain.py
Created March 22, 2016 08:08
Implementation of simple blockchain
import numpy as np
import hashlib
def create_block(parent_block, value, hashfunc):
""" ------------------------------------------------
String -> Block -> (Block -> String) -> Block
------------------------------------------------
Produce a new block from a string value and a hash
of its parent block. In this case, a block is also a string.
"""
@nh2
nh2 / git-submodule-depth-1-test.sh
Created March 4, 2016 15:22
Tests a git setup with a sumbodule that contains large files
# Tests a git setup with a sumbodule that contains large files.
# In particular, the submodule should be fetchable with `--depth 1`.
mkdir git-large-submodule-test
cd git-large-submodule-test/
mkdir repo-bare submodule-bare
cd repo-bare/
git init --bare
cd ..
cd submodule-bare/
@toolmantim
toolmantim / iterm_buildkite_inline_images.js
Last active May 14, 2016 19:38
Node functions for embedding images in your build output using iTerm or Buildkite
var fs = require('fs');
function artifactOutput(imagePath) {
return '\033]1338;url=artifact://' + imagePath + ';alt=' + imagePath + '\07\n';
}
function base64Output(imagePath) {
var encodedImage = fs.readFileSync(imagePath, {encoding: 'base64'});
return '\033]1337;File=name=' + imagePath + ';inline=1:' + encodedImage + '\07\n';
}
@elrikdante
elrikdante / geo_world_map_migration
Created December 30, 2015 05:31 — forked from scicco/geo_world_map_migration
Rails migration for GeoWorldMap db into postgresql db
class CreatePlaces < ActiveRecord::Migration
# Rails migration for GeoWorldMap db into postgresql db
#(inspired by http://blog.inspired.no/populate-your-database-with-free-world-cities-countries-regions-in-2-minutes-using-a-rails-migration-273/ post)
#extract files from GeoWorldMap.zip archive from here
# http://www.geobytes.com/GeoWorldMap.zip
#
#and place them into #{Rails.root}/db/migrate/
##the archive has 'cities.txt' file, rename it 'Cities.txt'
#mv cities.txt Cities.txt
@acowley
acowley / Compiler.hs
Created December 22, 2015 18:17
Use the GHC API to time the type checker
import Control.Arrow ((***))
import Control.Monad (replicateM_)
import Control.Monad.IO.Class
import Data.List (isPrefixOf)
import Data.Time.Clock
import DynFlags (defaultFatalMessager, defaultFlushOut, PkgConfRef(PkgConfFile))
import GHC
import GHC.Paths (libdir)
import System.FilePath (takeBaseName, splitExtension, addExtension)
import Text.Printf
@rafaelverger
rafaelverger / takess.js
Last active February 11, 2020 18:27
Taking screenshot of full document body using html2canvas and uploading to cloudinary
function takeSS(cloudinary_name, cloudinary_key, cloudinary_unsigned_preset, main_element){
main_element = main_element || document.body;
const imageUrlToBase64 = (url) => fetch(
`https://get-base64-image.rafaelverger.now.sh/?url=${encodeURIComponent(url)}`
).then(res => res.text());
const _takeSS = () => {
const elementImages = [].slice.call(
main_element.querySelectorAll('img'), 0
).filter(img => /^http/.test(img.src));
using CUDA on GPU 0...
Make sure that your saved checkpoint was also trained with GPU. If it was trained with CPU use -gpuid -1 for sampling as well
creating an lstm...
missing seed text, using uniform probability over first character
--------------------------
�y job is producing how people read out there. Our platform builds a core technology startup is established by hardest lifestal search and data structures and allowing us to be family on all shapes and shape some of the developers, including MacBook profiles, mongotiout and test achieved as the time to distribute the code. If you have any questions about all of our jobs page for more information to about us really among the latter to contribute to person because it's a very larger hands to do the intersection that lesss more varied or email me (http://blog.vittualsnownup.org/wiki/) – Full-Time, , Canada, Remote, Perl, POS, (or JavaScript (UI/UX)TEDY is a number of hiring software developers who are excited about technical hires to be quickly as th
@EugeneN
EugeneN / buildModule.hs
Last active March 7, 2016 04:59
Unix shell scripting in Haskell example
#!/usr/bin/env runhaskell
{-# LANGUAGE OverloadedStrings #-}
import Turtle
import Prelude hiding (FilePath)
import qualified Data.Text as T
import System.Environment (getArgs)
usage = "Please specify module name you would like to build as first argument."