Skip to content

Instantly share code, notes, and snippets.

View timperrett's full-sized avatar
🚧

Timothy Perrett timperrett

🚧
View GitHub Profile
@timperrett
timperrett / disable-tmobile-5g-home-internet-rotuer-wifi.md
Created November 14, 2023 01:25 — forked from orther/disable-tmobile-5g-home-internet-rotuer-wifi.md
JS Code To Disable WiFi for T-Mobile 5G Home Internet Router

This script can be copied into the browser console and used to disable wifi on the T-Mobile 5G Home Internet router. The web interface for the router doesn't allow you to disable it.

Steps

  1. Go to http://192.168.12.1
  2. Open dev console (on mac [cmd]+[opt]+i)
  3. Copy the code from the below JS file and with the password value updated to be your actual password and hit enter
  4. Call the code by typing tmobileHomeInternetDisableWifi() and hitting enter
@timperrett
timperrett / gist:e6079101ae469822a9b2c8c1a46429aa
Created April 30, 2018 07:56 — forked from luckydev/gist:b2a6ebe793aeacf50ff15331fb3b519d
Increate max no of open files limit in Ubuntu 16.04 for Nginx
# maximum capability of system
user@ubuntu:~$ cat /proc/sys/fs/file-max
708444
# available limit
user@ubuntu:~$ ulimit -n
1024
# To increase the available limit to say 200000
user@ubuntu:~$ sudo vim /etc/sysctl.conf
package com.rr.experiment
import org.specs2.ScalaCheck
import org.specs2.mutable._
import org.scalacheck._
import scalaz._
import scodec._
---
# ^^^ YAML documents must begin with the document separator "---"
#
#### Example docblock, I like to put a descriptive comment at the top of my
#### playbooks.
#
# Overview: Playbook to bootstrap a new host for configuration management.
# Applies to: production
# Description:
# Ensures that a host is configured for management with Ansible.
@timperrett
timperrett / js.scala
Created September 28, 2012 10:17
light js dsl
trait js {
implicit def arrayExpr[A](es: Seq[A])(implicit f: A => Expr): ArrayExpr =
ArrayExpr(es.map(f))
implicit def objectExpr[A](fs: Seq[(String, A)])(implicit f: A => Expr): ObjectExpr =
ObjectExpr(fs.map { case (k, v) => (k, f(v)) })
implicit def booleanLiteral(b: Boolean): LiteralBoolean = LiteralBoolean(b)
implicit def nodeSeqLiteral(ns: NodeSeq): LiteralNodeSeq = LiteralNodeSeq(ns)
implicit def numericLiteral[A: Numeric](n: A): LiteralNumeric[A] = LiteralNumeric(n)
implicit def stringLiteral(s: String): LiteralString = LiteralString(s)
implicit def symbolReference(in: Symbol): Reference = Reference(in.name)
@timperrett
timperrett / gist:3436334
Created August 23, 2012 12:51 — forked from chrislewis/gist:3416494
reader monad for java.util.Properties example
/* Start by creating a reader for some fake yet conceivable type for executing SQL queries. */
val dbReader: Reader[Properties, JdbcExecutor] =
for {
driver <- read[String]("db.driver")
uri <- read[String]("db.uri")
user <- read[String]("db.username")
password <- read[String]("db.password")
name <- read[String]("db.pool.name")
minCons <- read[Int]("db.pool.minConnections")
@timperrett
timperrett / latency.txt
Created May 31, 2012 09:29 — forked from jboner/latency.txt
Latency numbers every programmer should know
By Jeff Dean (http://research.google.com/people/jeff/):
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns
Mutex lock/unlock 25 ns
Main memory reference 100 ns
Compress 1K bytes with Zippy 3,000 ns
Send 2K bytes over 1 Gbps network 20,000 ns
Read 1 MB sequentially from memory 250,000 ns
@timperrett
timperrett / gist:1810800
Created February 12, 2012 20:53 — forked from teigen/gist:1435102
sbt multi setting example
lazy val yodawg = TaskKey[String]("yo-dawg", "I heard you liked settings, so I put a setting in your setting")
yodawg <<= Project.app(moduleName :^: version :^: isSnapshot :^: KNil){
case a :+: b :+: c :+: HNil => task(List(a, b, c).mkString("~"))
}
>show yo-dawg
[info] web~2.0-SNAPSHOT~true
// source: https://github.com/harrah/xsbt/blob/0.11/main/Structure.scala#L443
@timperrett
timperrett / Aggregator.scala
Created September 4, 2011 15:54 — forked from remeniuk/Aggregator.scala
Scatter-Gather with Akka Dataflow
class Aggregator(recipients: Iterable[ActorRef]) extends Actor{
def receive = {
case msg @ Message(text) =>
println("Started processing message `%s`" format(text))
val result = Promise[String]()
val promises = List.fill(recipients.size)(Promise[String]())
recipients.zip(promises).map{case (recipient, promise) =>
@timperrett
timperrett / GlassFish.scala
Created June 20, 2011 22:27 — forked from sdb/GlassFish.scala
create an SBT plug-in for running webapps in Glassfish
package sbt {
import org.glassfish.embeddable.{GlassFish, GlassFishRuntime, GlassFishProperties, Deployer}
trait GlassFishPlugin extends BasicWebScalaProject {
def glassFishPort = GlassFishRunner.DefaultPort
private lazy val glassFish = new GlassFishRunner(glassFishPort, temporaryWarPath)
lazy val glassfishRun = glassfishRunAction