Skip to content

Instantly share code, notes, and snippets.

View sadasant's full-sized avatar
👁️

Daniel Rodríguez sadasant

👁️
View GitHub Profile
@sadasant
sadasant / index.ts
Created June 26, 2020 19:06 — forked from willmtemple/index.ts
magic typescript function that returns its arguments' AST
// This uses my modified version of typescript from my branch github.com/willmtemple/typescript#fucking-parser
import * as ts from "typescript/built/local/typescript";
import * as fs from "fs";
import * as os from "os";
import { promisify } from "util";
const readFile = promisify(fs.readFile);
@sadasant
sadasant / RunAProxyOnAmazonEC2VPC.md
Created April 14, 2017 13:35 — forked from webinista/RunAProxyOnAmazonEC2VPC.md
Create a proxy server on an Amazon EC2 (VPC) instance

This will create a proxy server in whatever your availability zone your VPC is in. For me, that's us-east-1b. For you, that may be something different. Steps 10+ should more or less work regardless of your provider since those steps cover the setup and configuration of TinyProxy.

  1. Click the Launch Instance button.
  2. Choose Ubuntu Server 14.04 LTS (HVM), SSD Volume Type. This isn't strictly necessary. If you choose another OS, check its documentation for how to install new packages.
  3. On the Choose an Instance Type screen, select t2.micro. It's Free Tier eligible.
  4. Click the Next: ... buttons until you reach the Configure Security Group screen.
    • You may wish to reduce the amount of storage on the Add Storage screen. This is optional.
    • You may wish to add a tag on the Tag Instance screen. This is also optional.
  5. On the Configure Security Group screen:
  • Select Create a new security group.
@sadasant
sadasant / index.html
Created November 23, 2016 15:19 — forked from anonymous/index.html
Tic-Tac-Toe// source https://jsbin.com/qototad
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta id="viewport" name="viewport" content="width=device-width, initial-scale=1">
<title>Tic-Tac-Toe</title>
</head>
<body>
<div class='wrapper'>
@sadasant
sadasant / tdes.rb
Last active August 29, 2015 14:27 — forked from jinleileiking/tdes.rb
Ruby 3Des
require 'lib/ruby-des'
class TDES
class << self
def en_des plain, key
ret = ''
blocks = plain.scan(/.{16}/)
blocks.each do |block|
ret = ret + en_des_block(block, key)
end
@sadasant
sadasant / mrbc_fail.rb
Last active August 29, 2015 14:07 — forked from scalone/mrbc_fail.rb
# To compile `mrbc -o mrbc_fail.mrb mrbc_fail.rb`
class_decation_error T
def self.a
puts "aa"
end
end
@sadasant
sadasant / file_db.rb
Last active August 29, 2015 14:02 — forked from scalone/file_db.rb
class FileDb < Hash
attr_accessor :path
def initialize
super
end
def self.open(path)
f = self.new
@sadasant
sadasant / rb.rb
Created May 21, 2014 21:27 — forked from scalone/rb.rb
module T
def self.display
puts "display 1"
end
end
T.display
def T.display
puts "display 2"
// UTF8 Module
//
// Cleaner and modularized utf-8 encoding and decoding library for javascript.
//
// copyright: MIT
// author: Nijiko Yonskai, @nijikokun, nijikokun@gmail.com
(function (name, definition, context, dependencies) {
if (typeof context['module'] !== 'undefined' && context['module']['exports']) { if (dependencies && context['require']) { for (var i = 0; i < dependencies.length; i++) context[dependencies[i]] = context['require'](dependencies[i]); } context['module']['exports'] = definition.apply(context); }
else if (typeof context['define'] !== 'undefined' && context['define'] === 'function' && context['define']['amd']) { define(name, (dependencies || []), definition); }
else { context[name] = definition.apply(context); }
#Refer: http://www.linuxfoundation.org/collaborate/workgroups/networking/netem#Delaying_only_some_traffic
#Refer: http://www.bomisofmab.com/blog/?p=100
#Refer: http://drija.com/linux/41983/simulating-a-low-bandwidth-high-latency-network-connection-on-linux/
#Setup the rate control and delay
sudo tc qdisc add dev lo root handle 1: htb default 12
sudo tc class add dev lo parent 1:1 classid 1:12 htb rate 56kbps ceil 128kbps
sudo tc qdisc add dev lo parent 1:12 netem delay 200ms
#Remove the rate control/delay
sudo tc qdisc del dev lo root
@sadasant
sadasant / LICENSE
Last active August 29, 2015 13:56 — forked from ghostbar/LICENSE
Copyright © 2014 Jose Luis Rivas
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in