Skip to content

Instantly share code, notes, and snippets.

View Helloyunho's full-sized avatar
👋
Hiiiiii!!

Helloyunho Helloyunho

👋
Hiiiiii!!
View GitHub Profile
@gkastrinis
gkastrinis / post2.md
Last active November 15, 2022 15:43
Tablet as second PC monitor

Tablet as second PC monitor

Lately I've been thinking about using my old nexus 7 (from 2012) as a second PC monitor.

I've read articles regarding android apps for this purpose as well as comments from Google Play. Some examples can be found here and here. Bottom line, you have to pay and most likely you will end up struggling with (huge?) lag and/or compatibility issues. I tried splashtop but it felt lacking in some way, it was just mirroring my main monitor and it was free just for the first 5 minutes.

@sooop
sooop / StreamReader.swift
Last active June 23, 2024 22:49
Read a large text file line by line - Swift 3
import Foundation
class StreamReader {
let encoding: String.Encoding
let chunkSize: Int
let fileHandle: FileHandle
var buffer: Data
let delimPattern : Data
var isAtEOF: Bool = false
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active July 22, 2024 06:03
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@nirewen
nirewen / erisPrototypes.js
Last active June 7, 2022 02:10
A list of helpful functions for my Eris bot
let Endpoints = require("eris/lib/rest/Endpoints");
Object.defineProperties(Eris.Client.prototype, {
fetchChannel: {
value: function(channelID) {
return this.requestHandler.request("GET", Endpoints.CHANNEL(channelID), true).then((channel) => {
if (channel.type === 0) {
return new Eris.TextChannel(channel, null, this.options.messageLimit);
} else if (channel.type === 1) {
return new Eris.PrivateChannel(channel, this);
} else if (channel.type === 2) {
@srstsavage
srstsavage / nginx_google_analytics
Last active June 6, 2023 22:50
google analytics in nginx
# send logs for all traffic (including non-html) to google analytics
#
# in server block:
# set $google_analytics_id "UA-THECORRECT-ID";
# include /srv/nginx/google_analytics;
#
# in location blocks:
# post_action @ga;
#
# notes: post_action has been referred to by nginx devs as a "dirty hack" and this approach may stop working one day.
@samsch
samsch / stop-using-jwts.md
Last active July 15, 2024 09:26
Stop using JWTs

Stop using JWTs!

TLDR: JWTs should not be used for keeping your user logged in. They are not designed for this purpose, they are not secure, and there is a much better tool which is designed for it: regular cookie sessions.

If you've got a bit of time to watch a presentation on it, I highly recommend this talk: https://www.youtube.com/watch?v=pYeekwv3vC4 (Note that other topics are largely skimmed over, such as CSRF protection. You should learn about other topics from other sources. Also note that "valid" usecases for JWTs at the end of the video can also be easily handled by other, better, and more secure tools. Specifically, PASETO.)

A related topic: Don't use localStorage (or sessionStorage) for authentication credentials, including JWT tokens: https://www.rdegges.com/2018/please-stop-using-local-storage/

The reason to avoid JWTs comes down to a couple different points:

  • The JWT specification is specifically designed only for very short-live tokens (~5 minute or less). Sessions
@shial4
shial4 / DynamicList.swift
Last active June 7, 2024 09:25
SwiftUI Dynamic Horizontal or vertical List - loads only visible elements. Efficiency for large collections. Dynamic item size.
import SwiftUI
import Foundation
import PlaygroundSupport
public enum Orientation {
case horizontal
case vertical
}
public struct StackView<Content: View>: View {
@coolstar
coolstar / libblackjack.h
Last active October 10, 2022 10:56
libhooker/libblackjack headers
//
// libblackjack.h
// libblackjack
//
// Created by CoolStar on 2/24/20.
// Copyright © 2020 CoolStar. All rights reserved.
//
#include "libhooker.h"
@sindresorhus
sindresorhus / esm-package.md
Last active July 22, 2024 10:50
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@fxxntrbl
fxxntrbl / README.md
Last active May 26, 2021 18:33
Installing old macOS on your Mac

MacOS Release Date

El Capitan

date -u 1001000015

Official Release Date (10.11.0): September 30, 2015

Sierra