Skip to content

Instantly share code, notes, and snippets.

# coding: utf-8
import logging
import re
from collections import Counter
import numpy as np
import torch
from sklearn.datasets import fetch_20newsgroups
from torch.autograd import Variable
@DannyQuah
DannyQuah / 2022.01-D.Quah-Obsidian-iPad-syncing-via-iSH-git.md
Last active April 30, 2024 10:07
Obsidian on iPad syncing via iSH, git, and GitHub

Obsidian iPad syncing via iSH git

by Danny Quah, Jan 2022

This gist describes using Obsidian on iPad while syncing to other Obsidian platforms. The procedure uses git in iSH on iOS, and thus differs from using either Obsidian Sync or Working Copy as described in Obsidian/iOS+app.

(To be clear, Obsidian is one of my favourite Apps, and I'm all for supporting the team financially. Moreover, everything I've heard suggests the paid Obsidian Sync is excellent. However, I don't want my syncing processes to proliferate --- each service using a different client sync flow --- so I keep my systems minimal: just syncthing and git. After writing this I found an Obsidian Forum writeup which uses the same tools I do to achieve the same goal, but you'll want to read that with its accumulated contributions dispersed across the comments. So at least I was thinking

<?php
/**
* Description of VideoStream
*
* @author Rana
* @link http://codesamplez.com/programming/php-html5-video-streaming-tutorial
*/
class VideoStream
{
private $path = "";
@aamiaa
aamiaa / CompleteDiscordQuest.md
Last active April 30, 2024 10:03
Complete Recent Discord Quest

Complete Recent Discord Quest

Note

This no longer works in browser!

Note

This no longer works if you're alone in vc! Somebody else has to join you!

How to use this script:

  1. Accept the quest under User Settings -> Gift Inventory
@sisyphushappy
sisyphushappy / docker-stack.ts
Created May 24, 2022 04:11
Build a docker image asset, deploy it to ECR, and update a file in a remote GitHub repo with the docker image asset hash
import {Duration, Stack, StackProps} from "aws-cdk-lib";
import {Construct} from "constructs";
import {Repository} from "aws-cdk-lib/aws-ecr";
import {Function, LayerVersion, Runtime} from "aws-cdk-lib/aws-lambda";
import {ArnPrincipal, Effect, ManagedPolicy, PolicyStatement} from "aws-cdk-lib/aws-iam";
import {PythonFunction} from "@aws-cdk/aws-lambda-python-alpha";
import {DockerImageAsset} from "aws-cdk-lib/aws-ecr-assets";
import * as path from "path";
import * as ecrdeploy from 'cdk-ecr-deployment';
import {Secret} from "aws-cdk-lib/aws-secretsmanager";
@o11c
o11c / every-vm-tutorial-you-ever-studied-is-wrong.md
Last active April 30, 2024 09:59
Every VM tutorial you ever studied is wrong (and other compiler/interpreter-related knowledge)

Note: this was originally several Reddit posts, chained and linked. But now that Reddit is dying I've finally moved them out. Sorry about the mess.


URL: https://www.reddit.com/r/ProgrammingLanguages/comments/up206c/stack_machines_for_compilers/i8ikupw/ Summary: stack-based vs register-based in general.

There are a wide variety of machines that can be described as "stack-based" or "register-based", but not all of them are practical. And there are a lot of other decisions that affect that practicality (do variables have names or only address/indexes? fixed-width or variable-width instructions? are you interpreting the bytecode (and if so, are you using machine stack frames?) or turning it into machine code? how many registers are there, and how many are special? how do you represent multiple types of variable? how many scopes are there(various kinds of global, local, member, ...)? how much effort/complexity can you afford to put into your machine? etc.)

  • a pure stack VM can only access the top elemen
@iamnewton
iamnewton / bash-colors.md
Last active April 30, 2024 09:58
The entire table of ANSI color codes.

Regular Colors

Value Color
\e[0;30m Black
\e[0;31m Red
\e[0;32m Green
\e[0;33m Yellow
\e[0;34m Blue
\e[0;35m Purple
@0xEva
0xEva / IDA Pro lumen.abda.nl public Lumina server.md
Last active April 30, 2024 09:58
Setting up IDA Pro to use lumen.abda.nl public Lumina server

Compiling socat on Cygwin

  1. Get a copy of socat source code here http://www.dest-unreach.org/socat/
  2. Make sure to install gcc-core, libssl-devel, make
  3. In your Cygwin terminal, run ./configure --enable-openssl-base --enable-openssl-method
  4. make optionally make install

Set up IDA Pro to use lumen.abda.nl public Lumina server

  1. Get a copy of lumen.abda.nl's certificate here https://abda.nl/lumen/hexrays.crt
  2. Change PATH_TO_IDA in ida_abda.nl_lumen.bat then run it
  3. Go to Options -> General -> Lumina, set server addr to 127.0.0.1, port 1234, Username guest, Password guest