Skip to content

Instantly share code, notes, and snippets.

View greister's full-sized avatar
🎯
Focusing

greister

🎯
Focusing
View GitHub Profile
@benaryorg
benaryorg / getmyname.rs
Created July 16, 2015 17:05
get the name of the struct of a variable
#![feature(core_intrinsics)]
struct Something
{
data:u32,
}
impl Something
{
pub fn name(&self)->String
@odersky
odersky / A simpler way to returning the "current" type in Scala.
Last active April 5, 2024 13:34
A simpler way to returning the "current" type in Scala.
/** This is in reference to @tploecat's blog http://tpolecat.github.io/2015/04/29/f-bounds.html
* where he compares F-bounded polymorphism and type classes for implementing "MyType".
*
* Curiously, the in my mind obvious solution is missing: Use abstract types.
*
* A lot of this material, including an argument against F-bounded for the use-case
* is discussed in:
*
* Kim B. Bruce, Martin Odersky, Philip Wadler:
* A Statically Safe Alternative to Virtual Types. ECOOP 1998: 523-549
@osipov
osipov / gist:c2a34884a647c29765ed
Created July 21, 2014 19:12
Install Scala and SBT using apt-get on Ubuntu 14.04 or any Debian derivative using apt-get
sudo apt-get remove scala-library scala
sudo wget www.scala-lang.org/files/archive/scala-2.10.4.deb
sudo dpkg -i scala-2.10.4.deb
sudo apt-get update
sudo apt-get install scala
wget http://scalasbt.artifactoryonline.com/scalasbt/sbt-native-packages/org/scala-sbt/sbt/0.12.4/sbt.deb
sudo dpkg -i sbt.deb
sudo apt-get update
sudo apt-get install sbt
@bennadel
bennadel / code-1.htm
Created March 25, 2014 12:13
Creating A Fixed-Length Queue In JavaScript Using Arrays
<!DOCTYPE html>
<html>
<head>
<title>Fixed-Length Queue Data Type In JavaScript</title>
<script type="text/javascript">
// Create a constructor for the fixed-length queue. This is
// really more of a FACTORY than a construtor since an
@wbroek
wbroek / genymotionwithplay.txt
Last active February 13, 2025 09:37
Genymotion with Google Play Services for ARM
NOTE: Easier way is the X86 way, described on https://www.genymotion.com/help/desktop/faq/#google-play-services
Download the following ZIPs:
ARM Translation Installer v1.1 (http://www.mirrorcreator.com/files/0ZIO8PME/Genymotion-ARM-Translation_v1.1.zip_links)
Download the correct GApps for your Android version:
Google Apps for Android 6.0 (https://www.androidfilehost.com/?fid=24052804347835438 - benzo-gapps-M-20151011-signed-chroma-r3.zip)
Google Apps for Android 5.1 (https://www.androidfilehost.com/?fid=96042739161891406 - gapps-L-4-21-15.zip)
Google Apps for Android 5.0 (https://www.androidfilehost.com/?fid=95784891001614559 - gapps-lp-20141109-signed.zip)
@cdunklau
cdunklau / extract_attachments.py
Last active September 18, 2024 16:23
A simple (and probably naive) script to extract attachments from .eml files for those of us who don't use software email clients.
#!/usr/bin/env python
"""
Extract all attachments from MS Outlook '.eml' file EML_FILE into
directory OUTPUT_DIR. If OUTPUT_DIR does not exist, it will be
created.
Usage: extract_attachments.py EML_FILE OUTPUT_DIR
"""
from __future__ import print_function
import sys
@winny-
winny- / checksum.py
Last active August 29, 2015 13:56
Simple python tool for creating and checking digests. Useful on old Macs that don't have shasum(1), but have python with hashlib.
#!/usr/bin/env python
# Makes me mad that I had to write this. Damn you mac os x 10.5.8.
# I, Winston Weinert, hereby put this file in the public domain.
import hashlib
class Checksum(object):
@pascalpoitras
pascalpoitras / 1.md
Last active April 10, 2025 14:12
My WeeChat configuration

This configuration is not maintained anymore. You should think twice before using it, Breaking change and security issue will likely eventually happens as any abandonned project.

@leifg
leifg / Vagrantfile
Last active August 15, 2024 15:13
Add a second disk to system using vagrant
file_to_disk = './tmp/large_disk.vdi'
Vagrant::Config.run do |config|
config.vm.box = 'base'
config.vm.customize ['createhd', '--filename', file_to_disk, '--size', 500 * 1024]
config.vm.customize ['storageattach', :id, '--storagectl', 'SATA Controller', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', file_to_disk]
end
trait Functor[F[_]] {
def fmap[A,B](f: A => B): F[A] => F[B]
}
sealed trait Fruit
class Apple extends Fruit
class Orange extends Fruit
case class Basket[T](items: T*)