Skip to content

Instantly share code, notes, and snippets.

Avatar
📎
Keeping things together

Daniel Rodríguez sadasant

📎
Keeping things together
View GitHub Profile
@sadasant
sadasant / index.ts
Created Jun 26, 2020 — forked from willmtemple/index.ts
magic typescript function that returns its arguments' AST
View index.ts
// 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 / computer_tips.md
Last active Jan 20, 2020
Computer tips to Jen Gentleman
View computer_tips.md

Computer tips to Jen Gentleman.

For this Twitter thread: https://twitter.com/JenMsft/status/1218526323271823360

I've taken all of these from information I've found publicly available on the interner over the years. I haven't kept all of the sources.

I thought on adding more than bash-related stuff, but I ended up unconvinced. I hope some of this can be useful!

Index

View keybase.md

Keybase proof

I hereby claim:

  • I am sadasant on github.
  • I am sadasant (https://keybase.io/sadasant) on keybase.
  • I have a public key ASDfYbR_Nx35Pf2hogjNpqwWYCLmlG-xy80sToPxSMk94go

To claim this, I am signing this object:

View matchObject.test.js
const S = require('sanctuary')
let objectMatches = object => S.allPass(
S.map(([k, v]) =>
S.pipe([
S.prop(k),
S.is(Function, v) ?
v :
S.is(RegExp, v) ?
S.test(v) :
@sadasant
sadasant / RunAProxyOnAmazonEC2VPC.md
Created Apr 14, 2017 — forked from webinista/RunAProxyOnAmazonEC2VPC.md
Create a proxy server on an Amazon EC2 (VPC) instance
View RunAProxyOnAmazonEC2VPC.md

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 / foldWhile.mkd
Last active Mar 16, 2017
Recursive fold takeWhile (as in haskell)
View foldWhile.mkd

Recursive fold takeWhile (as in haskell). Lazy evaluated!

  • Iterates depth-first every element of a nested data structure given as obj.
  • Runs only while the iterator fn returns true.
  • The fn iterator receives:
    • An accumulator, that by default is an array, but that can be defined as anything else in the third parameter given to foldWhile.
    • The next value iterated.
@sadasant
sadasant / DurandalHistoryCheckUrl
Created Jan 25, 2017
Duranda's History checkUrl fix
View DurandalHistoryCheckUrl
/**
* Checks the current URL to see if it has changed, and if it has, calls `loadUrl`, normalizing across the hidden iframe.
* @method checkUrl
* @return {boolean} Returns true/false from loading the url.
*/
function cleanFragment(s) {
return s
.replace(/%7E/g, "~")
.replace(/%21/g, "!")
.replace(/%2A/g, "*")
View index.html
<!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'>
View eule3jserror
node E0003-Sieve.js
<--- Last few GCs --->
7126 ms: Mark-sweep 1096.1 (1134.7) -> 659.1 (697.6) MB, 181.5 / 0 ms [allocation failure] [GC in old space requested].
7327 ms: Mark-sweep 659.1 (697.6) -> 658.8 (697.6) MB, 201.1 / 0 ms [allocation failure] [GC in old space requested].
7509 ms: Mark-sweep 658.8 (697.6) -> 658.8 (697.6) MB, 181.4 / 0 ms [last resort gc].
7711 ms: Mark-sweep 658.8 (697.6) -> 658.8 (697.6) MB, 202.1 / 0 ms [last resort gc].
@sadasant
sadasant / tdes.rb
Last active Aug 29, 2015 — forked from jinleileiking/tdes.rb
Ruby 3Des
View tdes.rb
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
You can’t perform that action at this time.