Skip to content

Instantly share code, notes, and snippets.

View rakhmad's full-sized avatar

Rakhmad Azhari rakhmad

View GitHub Profile
@ronny
ronny / fat-vs-thin-arrows.coffee
Last active August 29, 2015 14:04
The main difference between fat and thin arrows for instance methods in CoffeeScript
# Try running this in http://coffeescript.org 's "Try CoffeeScript" tab while having the DevTools console open.
class Foo
thin: (arg) ->
console.log 'thin', this, @value?(), arg
fat: (arg) =>
console.log 'fat', this, @value?(), arg
value: ->
'foobar'
@mpasternacki
mpasternacki / flakes.py
Created May 25, 2010 12:41
Django management command to run pyflakes against Django project
from django.conf import settings
from django.core.management.base import BaseCommand
#### pyflakes.scripts.pyflakes, modified:
## - return array of warnings instead of printing them
## - honour pyflakes:ignore comments
import compiler, sys
import os
import pyflakes.checker
@T31337
T31337 / CapCam.py
Last active January 11, 2017 12:49
ScreenRecorder&Microphone Audio Recorder Using FFMPEG & Python
#!/usr/bin/env python3
'''
This Script Is Mainly From A Youtube User,
I Only Modified It Slightly To Make It Python3 Compatable,
And Added Custom Microphone Recording Support
Original Source Code: http://pastebin.com/BY1t5AcC
Thanks To Youtube User NoBeansJose
License:
@interface UIWindow (resize)
-(void)_adjustSizeClassesAndResizeWindowToFrame:(CGRect)frame;
@end
typedef enum _UICustomRes
{
UICustomResiPadTwoThirds,
UICustomResiPadHalf,
UICustomResiPadOneThird,
UICustomResiPhone47,
@gabrielemariotti
gabrielemariotti / BatteryActivity.java
Created July 15, 2014 22:56
Android Wear: small gist to get data from Battery
public class BatteryActivity extends Activity {
//UI Elements
private TextView mTextViewLevel;
private TextView mTextViewTemperature;
private TextView mTextViewVoltage;
private TextView mTextViewHealth;
//Battery details
private int level;
@jmoy
jmoy / thin-film.ipynb
Last active November 18, 2018 19:51
Why soap bubbles are colorful and windowpanes are not
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@hedwigz
hedwigz / main.go
Last active September 9, 2019 03:19
try reproduce resty race
package main
import (
"crypto/tls"
"fmt"
"log"
"net/http"
"sync"
"sync/atomic"
"time"
require 'rubygems'
require 'openssl'
require 'digest/md5'
key = OpenSSL::PKey::RSA.new(2048)
cipher = OpenSSL::Cipher::AES.new(256, :CBC)
ctx = OpenSSL::SSL::SSLContext.new
puts "Spoof must be in DER format and saved as root.cer"
raw = File.read "root.cer"
cert = OpenSSL::X509::Certificate.new raw
cert.version = 2
@zats
zats / ↔️.js
Created February 11, 2018 22:00
Bookmarklets for fullscreen, entering picture-in-picture, switching between fast and normal playback
javascript:document.getElementsByTagName('video')%5B0%5D.webkitEnterFullscreen()
@djspiewak
djspiewak / streams-tutorial.md
Created March 22, 2015 19:55
Introduction to scalaz-stream

Introduction to scalaz-stream

Every application ever written can be viewed as some sort of transformation on data. Data can come from different sources, such as a network or a file or user input or the Large Hadron Collider. It can come from many sources all at once to be merged and aggregated in interesting ways, and it can be produced into many different output sinks, such as a network or files or graphical user interfaces. You might produce your output all at once, as a big data dump at the end of the world (right before your program shuts down), or you might produce it more incrementally. Every application fits into this model.

The scalaz-stream project is an attempt to make it easy to construct, test and scale programs that fit within this model (which is to say, everything). It does this by providing an abstraction around a "stream" of data, which is really just this notion of some number of data being sequentially pulled out of some unspecified data source. On top of this abstraction, sca