Skip to content

Instantly share code, notes, and snippets.

View NghiaTranUIT's full-sized avatar
💭
Workaholic 👨‍💻

Noah Tran NghiaTranUIT

💭
Workaholic 👨‍💻
View GitHub Profile
@huytd
huytd / wordle.md
Last active November 1, 2024 05:07
Wordle in less than 50 lines of Bash

image

How to use:

./wordle.sh

Or try the unlimit mode:

The correct way, install homebrew on apple m1.

# We'll be installing Homebrew in the /opt directory.
cd /opt

# Create a directory for Homebrew. This requires root permissions.
sudo mkdir homebrew

# Make us the owner of the directory so that we no longer require root permissions.
sudo chown -R $(whoami) /opt/homebrew
@NghiaTranUIT
NghiaTranUIT / proxyman_iOS_playground.swift
Created January 31, 2020 02:28
A workaround to enable SSL Proxying on iOS Swift Playground for Charles and Proxyman app. (swift 5)
// This workaround is only for iOS Swift Playground
// Don't need it on macOS Playground
import Foundation
// Accept all challenges from Charles or Proxyman for self-signed certificates
class NetworkSSlProxying: NSObject, URLSessionDelegate {
func urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) {
completionHandler(.useCredential, URLCredential(trust: challenge.protectionSpace.serverTrust!))
}
}
@AvdLee
AvdLee / DarwinNotificationCenter.swift
Last active November 1, 2024 11:56
A notification center for Darwin Notifications. MIT License applies.
//
// DarwinNotificationCenter.swift
//
// Copyright © 2017 WeTransfer. All rights reserved.
//
import Foundation
/// A Darwin notification payload. It does not contain any userInfo, a Darwin notification is purely event handling.
public struct DarwinNotification {
# Luke's config for the Zoomer Shell
# Enable colors and change prompt:
autoload -U colors && colors
PS1="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%~%{$fg[red]%}]%{$reset_color%}$%b "
# History in cache directory:
HISTSIZE=10000
SAVEHIST=10000
HISTFILE=~/.cache/zsh/history
@SamL98
SamL98 / skiphook.m
Created June 6, 2019 00:01
Hooks and accompanying code for Skiptracing
// MARK: SkipManager
#define NUM_SKIP_BYTES 10
#define BYTES_PER_LINE 34
#define SKIP_FILE_PATH "/Users/samlerner/Documents/Spotify/skipped.csv"
// SkipManager class to handle writing skips to files
class SkipManager {
public:
@yycking
yycking / JavaScriptCore+fetch.swift
Last active January 20, 2024 08:54
add fetch, console.log and Promise.then/catch to JavaScriptCore on iOS/Mac
import JavaScriptCore
extension JSContext {
subscript(key: String) -> Any {
get {
return self.objectForKeyedSubscript(key) as Any
}
set{
self.setObject(newValue, forKeyedSubscript: key as NSCopying & NSObjectProtocol)
}
@kenilt
kenilt / MutableListTypeAdapter.kt
Last active August 2, 2018 05:57
Gson: Treat null as empty string or empty array
import com.google.gson.TypeAdapter
import com.google.gson.stream.JsonReader
import com.google.gson.stream.JsonToken
import com.google.gson.stream.JsonWriter
import java.io.IOException
class MutableListTypeAdapter<T>(private val delegate: TypeAdapter<MutableList<T>>?) : TypeAdapter<MutableList<T>>() {
@Throws(IOException::class)
override fun write(out: JsonWriter?, value: MutableList<T>?) {
@swalkinshaw
swalkinshaw / tutorial.md
Last active November 13, 2023 08:40
Designing a GraphQL API
@dobesv
dobesv / dev_signed_cert.sh
Last active October 14, 2024 08:30
Script to create (1) a local certificate authority, (2) a host certificate signed by that authority for the hostname of your choice
#!/usr/bin/env bash
#
# Usage: dev_signed_cert.sh HOSTNAME
#
# Creates a CA cert and then generates an SSL certificate signed by that CA for the
# given hostname.
#
# After running this, add the generated dev_cert_ca.cert.pem to the trusted root
# authorities in your browser / client system.
#