Skip to content

Instantly share code, notes, and snippets.

View DemonGiggle's full-sized avatar
🐵
Je pense donc je suis

gigo DemonGiggle

🐵
Je pense donc je suis
View GitHub Profile
@DemonGiggle
DemonGiggle / Decode.java
Created April 1, 2020 10:39
Some evil android app (to de-shell it)
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Base64;
import java.util.Base64.Decoder;
@DemonGiggle
DemonGiggle / print.cxx
Created September 15, 2019 14:54
verbose print
#include <array>
#include <vector>
#include <iostream>
template<typename T>
void print(const T &input, bool with_newline = true) {
for (auto it = input.begin(); it != input.end(); ++it) {
if (std::next(it) == input.end()) {
std::cout << *it;
}
@DemonGiggle
DemonGiggle / print.cxx
Created September 15, 2019 14:54
verbose print
#include <array>
#include <vector>
#include <iostream>
template<typename T>
void print(const T &input, bool with_newline = true) {
for (auto it = input.begin(); it != input.end(); ++it) {
if (std::next(it) == input.end()) {
std::cout << *it;
}
@DemonGiggle
DemonGiggle / print.cxx
Created September 15, 2019 14:54
verbose print
#include <array>
#include <vector>
#include <iostream>
template<typename T>
void print(const T &input, bool with_newline = true) {
for (auto it = input.begin(); it != input.end(); ++it) {
if (std::next(it) == input.end()) {
std::cout << *it;
}
@DemonGiggle
DemonGiggle / _stackdriver-log-to-goaccess.md
Last active March 30, 2020 09:09
stackdriver log converts to goaccess format
  1. Use gcloud logging read to pull logs
  2. Convert it to csv style via json2csv.rb
ruby json2csv.rb
  1. Use goaccess to generate html output
@DemonGiggle
DemonGiggle / simple_worker.rb
Created April 12, 2017 04:50
但事實證明是無法的,原因為動態產生的 class,在 sidekiq 環境中並無法得知
require "sidekiq/worker"
##
# 因為 Sidekiq::Worker 預設執行 perform,所以此 module 可以讓我們指定 sidekiq 要
# 執行的函示
#
# class Foo
# include SimpleWorker
#
# simple_worker_performer :bar
@DemonGiggle
DemonGiggle / gist:c82ca110a602de04c070f296977a004d
Created March 30, 2016 17:22 — forked from mtigas/gist:952344
Mini tutorial for configuring client-side SSL certificates.

Client-side SSL

For excessively paranoid client authentication.

Using self-signed certificate.

Create a Certificate Authority root (which represents this server)

Organization & Common Name: Some human identifier for this server CA.

openssl genrsa -des3 -out ca.key 4096
openssl req -new -x509 -days 365 -key ca.key -out ca.crt
private void encodeDecodeVideo() {
int width = 328, height = 248;
int bitRate = 1000000;
int frameRate = 15;
String mimeType = "video/avc";
int threshold = 50;
int maxerror = 50;
MediaCodec encoder, decoder = null;
ByteBuffer[] encoderInputBuffers;