Skip to content

Instantly share code, notes, and snippets.

@alanma
alanma / Techsumprompt
Created February 6, 2025 21:22 — forked from Bedrovelsen/Techsumprompt
Tech summary prompt
<text>
CONTENT
</text>
You're the best content writer in the world. Describe each section of the provided article text within the <text> tags in full detail, including explaining any formulas, algorithms, or key concepts covered in each section.
First, carefully read through the entire <text> tags. Think step by step and write out a brief outline of the key sections you identified in the <scratchpad> tags.
Then, go through each section one by one and write a detailed description of that section inside <section> tags. Follow the format provided below:
<format> → Section summary → Key terms and concepts → Formula and algorithm explanations → Relationship to previous sections → Assumptions, constraints, limitations, and implications </format>
@alanma
alanma / redirectExample.go
Created June 19, 2018 22:53 — forked from d-schmidt/redirectExample.go
How to redirect HTTP to HTTPS with a golang webserver.
package main
import (
"net/http"
"log"
)
func redirect(w http.ResponseWriter, req *http.Request) {
// remove/add not default ports from req.Host
target := "https://" + req.Host + req.URL.Path
if len(req.URL.RawQuery) > 0 {
@alanma
alanma / youtubeup.sh
Created April 25, 2018 04:18 — forked from aclud/youtubeup.sh
Script to take videos FTP'ed from my D-Link DCS-5010L, compile the 15 second clips into one video, upload it to YouTube and email the URL to me.Requires: mencoder mailx youtube-upload (https://code.google.com/p/youtube-upload/)Run via cron
#!/bin/bash
#setup variables
x="/share/cam" #base dir to search
age="1" #minimum age in minutes of file to include in processing
date=$(date +"%Y%m%d%H%M") #date used throughout script
fileprefix="YT-5010L-" #output file name prefix
ytemail="youremail" #your youtube email account
ytpassword="password" #your youtube password
emailfrom="youremail(Your Name)" #your email address and from name
emailuser="youremail" #your gmail address
@alanma
alanma / autodlyt.sh
Created April 25, 2018 04:14 — forked from untergrundbiber/autodlyt.sh
Auto-downloading YouTube new subscription videos http://blog.yjl.im/2010/11/auto-downloading-youtube-new.html
#!/bin/bash
# by Yu-Jie Lin
# BSD license
# 2010-11-10T19:13:46+0800
usage () {
echo "Usage: $(basename $0) username directory-to-store-everything"
exit 1
}
<static-files>
<include path="/my_static-files" >
<http-header name="Access-Control-Allow-Origin" value="http://example.org" />
</include>
</static-files>
<security-constraint>
<web-resource-collection>
<web-resource-name>profile</web-resource-name>
<url-pattern>/profile/*</url-pattern>
<static-files>
<include path="/my_static-files" >
<http-header name="Access-Control-Allow-Origin" value="http://example.org" />
</include>
</static-files>
<security-constraint>
<web-resource-collection>
<web-resource-name>profile</web-resource-name>
<url-pattern>/profile/*</url-pattern>
@alanma
alanma / Spark+ipython_on_MacOS.md
Created January 13, 2017 05:59 — forked from ololobus/Spark+ipython_on_MacOS.md
Apache Spark installation + ipython notebook integration guide for Mac OS X

Apache Spark installation + ipython notebook integration guide for Mac OS X

Tested with Apache Spark 1.3.1, Python 2.7.9 and Java 1.8.0_45 + workaround for Spark 1.4.x from @enahwe.

Install Java Development Kit

Download and install it from oracle.com

package main
import (
"crypto/rand"
"crypto/rsa"
"crypto/sha1"
"crypto/x509"
"encoding/base64"
"encoding/pem"
"fmt"
using System;
using System.Text;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
namespace Qiniu.Util
{
public static class Base64URLSafe
{
public static string Encode (string text)
@alanma
alanma / go_load_test.go
Created May 9, 2016 04:02 — forked from jemygraw/go_load_test.go
load test for server
package main
import (
"flag"
"fmt"
"io"
"net/http"
"os"
"runtime"
"sync"