Skip to content

Instantly share code, notes, and snippets.

@popk
popk / cvpicker.py
Created December 17, 2019 19:52 — forked from trhura/cvpicker.py
opencv color picker
#! /usr/bin/env python2
import cv2
import numpy as np
colors = []
def on_mouse_click (event, x, y, flags, frame):
if event == cv2.EVENT_LBUTTONUP:
colors.append(frame[y,x].tolist())
@popk
popk / winlogon.reg
Created February 12, 2018 14:46 — forked from anonymous/winlogon.reg
WinLogon Windows 7 x64 COM Hijack
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\SOFTWARE\Classes\AtomicRedTeam.1.00]
@="AtomicRedTeam"
[HKEY_CURRENT_USER\SOFTWARE\Classes\AtomicRedTeam.1.00\CLSID]
@="{00000001-0000-0000-0000-0000FEEDACDC}"
[HKEY_CURRENT_USER\SOFTWARE\Classes\AtomicRedTeam]
@="AtomicRedTeam"
[HKEY_CURRENT_USER\SOFTWARE\Classes\AtomicRedTeam\CLSID]
@="{00000001-0000-0000-0000-0000FEEDACDC}"
[HKEY_CURRENT_USER\SOFTWARE\Classes\CLSID\{00000001-0000-0000-0000-0000FEEDACDC}]
@popk
popk / executable.c
Created February 8, 2018 13:59 — forked from jdarpinian/executable.c
Add one line to your C/C++ source to make it executable.
///bin/true;COMPILER_OPTIONS="-g -Wall -Wextra --std=c99 -O1 -fsanitize=address,undefined";THIS_FILE="$(cd "$(dirname "$0")"; pwd -P)/$(basename "$0")";OUT_FILE="/tmp/build-cache/$THIS_FILE";mkdir -p "$(dirname "$OUT_FILE")";test "$THIS_FILE" -ot "$OUT_FILE" || $(which clang || which gcc) $COMPILER_OPTIONS -xc "$THIS_FILE" -o "$OUT_FILE" || exit;exec "$OUT_FILE" "$@"
#include <stdio.h>
int main() {
printf("Hello world!\n");
return 0;
}
@popk
popk / gps.hpp
Created January 6, 2018 05:49 — forked from nazt/gps.hpp
gps.hpp
#include <Arduino.h>
#include "gnss.h"
GNSS gps;
float GPS_SEARCH_TIMEOUT_S = 40;
extern uint8_t LED;
// volatile char GNSS_data[58] = "";
char GNSS_data[58] = "";
String gps_data = "";
@popk
popk / vernemq_grafana.json
Created January 4, 2018 04:51 — forked from dergraf/vernemq_grafana.json
VerneMQ Grafana Single Node Dashboard
{
"id": 1,
"title": "VerneMQ",
"originalTitle": "VerneMQ",
"tags": [],
"style": "dark",
"timezone": "browser",
"editable": true,
"hideControls": false,
"sharedCrosshair": false,
@popk
popk / note
Created November 24, 2017 05:19 — forked from zhoukekestar/note
openvpn on aliyun
# Aliyun OpenVPN: https://help.aliyun.com/knowledge_detail/42521.html
# sudo bash update_source.sh // usa can't visit mirrors.aliyun.com
yum install -y lzo lzo-devel openssl openssl-devel pam pam-devel pkcs11-helper pkcs11-helper-devel
rpm -qa lzo lzo-devel openssl openssl-devel pam pam-devel pkcs11-helper pkcs11-helper-devel
wget http://oss.aliyuncs.com/aliyunecs/openvpn-2.2.2.tar.gz
yum install -y rpm-build gcc gcc-c++
rpmbuild -tb openvpn-2.2.2.tar.gz
# rpm -ivh openvpn-2.2.2-1.x86_64.rpm
rpm -ivh ./rpmbuild/RPMS/x86_64/openvpn-2.2.2-1.x86_64.rpm
cd /usr/share/doc/openvpn-2.2.2/easy-rsa/2.0
@popk
popk / server.conf
Created November 16, 2017 07:50 — forked from laurenorsini/server.conf
OpenVPN configuration for /etc/openvpn/server.conf
local 192.168.2.0 # SWAP THIS NUMBER WITH YOUR RASPBERRY PI IP ADDRESS
dev tun
proto udp #Some people prefer to use tcp. Don't change it if you don't know.
port 1194
ca /etc/openvpn/easy-rsa/keys/ca.crt
cert /etc/openvpn/easy-rsa/keys/Server.crt # SWAP WITH YOUR CRT NAME
key /etc/openvpn/easy-rsa/keys/Server.key # SWAP WITH YOUR KEY NAME
dh /etc/openvpn/easy-rsa/keys/dh1024.pem # If you changed to 2048, change that here!
server 10.8.0.0 255.255.255.0
# server and remote endpoints
@popk
popk / _service.md
Created November 5, 2017 21:11 — forked from fengye/_service.md
Sample /etc/init.d script

Sample service script for debianoids

Look at LSB init scripts for more information.

Usage

Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
const char* ssid = "..............";
const char* password = "................";
String form = "<form action='led'><input type='radio' name='state' value='1' checked>On<input type='radio' name='state' value='0'>Off<input type='submit' value='Submit'></form>";
String imagepage = "<img src='/led.png'>";
@popk
popk / bouncing_dot.c
Created October 23, 2017 17:49 — forked from adam-buckley/bouncing_dot.c
Onion Omega2 - I2C OLED Bouncing Dot using C
/**
* A small demo of a dot bouncing inside a 128x64 OLED screen, using the Onion Omega 2. Note this isn't using the
* OLED expansion, but a cheapo screen I bought from China, using the SSD1306 (as far as I could tell) driver.
* This was only a personal exercise to see how easy it is to setup, it might be handly to someone else learning!
*
* To compile:
* - install gcc and make (See: https://docs.onion.io/omega2-docs/c-compiler-on-omega.html)
* - install git (Follow this: https://docs.onion.io/omega2-docs/installing-and-using-git.html)
* - install python-dev
* - git clone the i2c exp driver (https://github.com/OnionIoT/i2c-exp-driver)