Skip to content

Instantly share code, notes, and snippets.

@asukakenji
asukakenji / 0-go-os-arch.md
Last active May 13, 2024 09:32
Go (Golang) GOOS and GOARCH

Go (Golang) GOOS and GOARCH

All of the following information is based on go version go1.17.1 darwin/amd64.

GOOS Values

GOOS Out of the Box
aix
android
@mschoebel
mschoebel / main.go
Created March 6, 2014 20:02
Snippet: login/logout (Golang)
package main
import (
"fmt"
"github.com/gorilla/mux"
"github.com/gorilla/securecookie"
"net/http"
)
// cookie handling
@XVilka
XVilka / TrueColour.md
Last active April 8, 2024 14:02
True Colour (16 million colours) support in various terminal applications and terminals

THIS GIST WAS MOVED TO TERMSTANDARD/COLORS REPOSITORY.

PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!

anonymous
anonymous / gist:7572848
Created November 20, 2013 23:06
BOOL WINAPI DllMain(HINSTANCE module_handle, DWORD reason_for_call, LPVOID reserved)
{
if (reason_for_call == DLL_PROCESS_ATTACH) // Self-explanatory
{
DisableThreadLibraryCalls(module_handle); // Disable DllMain calls for DLL_THREAD_*
if (reserved == NULL) // Dynamic load
{
foobar_meow(); // Initialize your stuff or whatever
// Return FALSE if you don't want your module to be dynamically loaded
}
anonymous
anonymous / gist:7179097
Created October 27, 2013 08:17
C++ Fast Integer To String Conversion
/*
*****************************************************************************
* The C++ Integer To String Conversion Benchmark *
* *
* This benchmark is based on the solutions provided in the following *
* stackoverflow question: *
* *
* http://stackoverflow.com/q/4351371 (Date: 20101204) *
* *
* Title: C++ Performance Challenge - Integer To std::string Conversion *

Exploiting Lua 5.1 on 32-bit Windows

The following Lua program generates a Lua bytecode program called ignore-unsigned-sga.fnt, which in turn loads a DLL from within an extremely locked down Lua 5.1 sandbox in a program called RelicCOH2.exe. The remainder of this document attempts to explain how this program works by a whirlwind tour of relevent bits of the Lua 5.1 virtual machine.

if string.dump(function()end):sub(1, 12) ~= "\27Lua\81\0\1\4\4\4\8\0" then
  error("This generator requires a 32-bit version of Lua 5.1")
end

local function outer()
  local magic -- In bytecode, the stack slot corresponding to this local is changed
@XueshiQiao
XueshiQiao / wwdc_combine_webvtt.rb
Last active August 21, 2018 00:34
combine WWDC subtitle files (fileSequence*.webvtt) to a srt file.
#!/usr/bin/ruby
docPath = "wwdc_srts"
#exclude . and .. folder
folders = Dir.entries(docPath).select{|folder| folder.to_i > 0}
folders.each{ |folder|
print folder
print "\n"
sequenceFilePath = docPath + "/" + folder
@XueshiQiao
XueshiQiao / extract.py
Last active April 8, 2018 02:20 — forked from nriley/extract.py
import requests
import os, re, sys
RE_SD_VIDEO = re.compile(
r'<a href="(http://devstreaming.apple.com/videos/wwdc/2013/[^"]*-SD.mov)')
RE_WEBVTT = re.compile(r'fileSequence[0-9]+\.webvtt')
# stdin: dump of https://developer.apple.com/wwdc/videos/
for l in sys.stdin:
m = RE_SD_VIDEO.search(l)
@grigio
grigio / Google-Reader-open-source-alternatives.md
Last active July 30, 2021 02:45
Google Reader open source alternatives & features

Here some Google Reader Open Source alternatives with the most expected features.

Please fork and help me to keep it updated.

Name language Database has categories Responsive/Mobile
Commafeed java hsql,mysql/postgresql
Freader nodejs mongodb ???
Goread go appengine
Miniflux php
@nriley
nriley / extract.py
Created June 27, 2013 06:51
Extract English subtitle text for WWDC 2013 videos.
import requests
import os, re, sys
RE_SD_VIDEO = re.compile(
r'<a href="(http://devstreaming.apple.com/videos/wwdc/2013/[^"]*-SD.mov)')
RE_WEBVTT = re.compile(r'fileSequence[0-9]+\.webvtt')
# stdin: dump of https://developer.apple.com/wwdc/videos/
for l in sys.stdin:
m = RE_SD_VIDEO.search(l)