Skip to content

Instantly share code, notes, and snippets.

@sunary
sunary / Dockerfile
Created December 27, 2017 09:30
Nodejs Docker
FROM node:7.6.0
ADD package.json /tmp/package.json
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
ADD . /usr/src/app
RUN npm rebuild node-sass
@sunary
sunary / name.service
Last active April 9, 2018 07:06
systemd
sudo vi /etc/systemd/system/name.service
`
[Unit]
Description = ...
After = network.target
[Service]
WorkingDirectory = /home/sunary/dir
ExecStart = /usr/bin/python /home/sunary/dir/run.py
User = sunary
Restart = always
@sunary
sunary / tips.md
Created June 4, 2018 03:35
mac tips

disable builtin keyboard:

sudo kextunload /System/Library/Extensions/AppleUSBTopCase.kext/Contents/PlugIns/AppleUSBTCKeyboard.kext

enable builtin keyboard:

sudo kextload /System/Library/Extensions/AppleUSBTopCase.kext/Contents/PlugIns/AppleUSBTCKeyboard.kext
@sunary
sunary / decorator.ts
Created June 11, 2018 10:28
ts decorator
export function NeedAuthorization() {
return (target, key, descriptor) => {
if (descriptor === undefined) {
descriptor = Object.getOwnPropertyDescriptor(target, key);
}
const originalMethod = descriptor.value;
descriptor.value = function(...args) {
if (args.length >= 3) {
const context = args[2];
if (!context || !context.user) {
@sunary
sunary / pusher_client.md
Last active July 28, 2018 06:00
pusher websocket
@sunary
sunary / fanout.go
Last active April 1, 2019 16:02
Play with go channel
# source https://play.golang.org/p/jwdtDXVHJk
package main
import (
"fmt"
"time"
)
func producer(iters int) <-chan int {
@sunary
sunary / lispy.py
Created October 30, 2018 00:41
lisp parser
def read_from_tokens(tokens):
token = tokens.pop(0)
if token == '(':
L = []
while tokens[0] != ')':
L.append(read_from_tokens(tokens))
tokens.pop(0)
return L
elif token == ')':
raise SyntaxError('unexpected )')
// same https://play.golang.org/p/3vGkbJ8OiNC
package main
const C = 12345678
func power(x, y int64) int64 {
a := int64(1)
for ; ; {
if (y & 1) != 0 {
@sunary
sunary / readme.md
Last active August 13, 2025 02:26
bypass ssl pinning

Decompile android

  • Download apktool from https://ibotpeaches.github.io/Apktool/
  • Unpack apk file: java -jar apktool.jar d app.apk
  • Modify AndroidManifest.xml by adding android:networkSecurityConfig="@xml/network_security_config" attribute to application element.
  • Create file /res/xml/network_security_config.xml with following content:
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>