Skip to content

Instantly share code, notes, and snippets.

Avatar
👻
Hunting bugs like Ghost Buster !

Moki Ding m0k1

👻
Hunting bugs like Ghost Buster !
View GitHub Profile
View vesta_ssl
#!/bin/bash
cert_src="/home/admin/conf/web/ssl.tesla.m0k1.net.pem"
key_src="/home/admin/conf/web/ssl.tesla.m0k1.net.key"
cert_dst="/usr/local/vesta/ssl/certificate.crt"
key_dst="/usr/local/vesta/ssl/certificate.key"
if ! cmp -s $cert_dst $cert_src
then
# Copy Certificate
@m0k1
m0k1 / hexosyntax.js
Created Jul 20, 2016
Nice hexo/hacker style syntax for your blog post's
View hexosyntax.js
document.addEventListener('DOMContentLoaded', function() {
var charcolors = {'a':"red", 'b':"orange", 'c':"cyan", 'd':"yellow", 'e':"blue", 'f':"purple", 'g':"red", 'h':"orange", 'i':"yellow", 'j':"green", 'k':"blue", 'l':"blue", 'm':"red", 'n':"orange", 'o':"yellow", 'p':"green", 'q':"blue", 'r':"purple", 's':"green", 't':"orange", 'u':"yellow", 'v':"green", 'w':"blue", 'x':"purple", 'y':"red", 'z':"orange", '1':"red", '2':"green", '3':"red", '4':"purple", '5':"orange", '6':"blue", '7':"red", '8':"orange", '9':"orange", '0':"yellow", '!':"red", '@':"red", '#':"blue", '$':"green", '%':"yellow", '^':"green", '&':"red", '*':"yellow", '+':"orange", '-':"orange", '_':"yellow", '.':"blue", '|':"green", '?':"green", '{':"orange", '}':"orange", '=':"green", '~':"yellow", "'":"purple", '"':"purple", "(":"yellow", ")":"yellow", "/":"green", "<":"green", ">":"green", ";":"purple", "[":"red", "]":"red", ":":"cyan"};
var colorhexes = {
"red": "#ff6666",
"orange": "#ff9933",
"yellow": "#ffff66",
"gr
View SentoraLetsEncrypt.html
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="https://code.jquery.com/jquery-1.9.1.js"></script>
<title>LetsEcryptSentora</title>
<script type='text/javascript'>
//<![CDATA[
$(window).load(function()
{
@m0k1
m0k1 / AutoOpenVPN.sh
Last active Dec 27, 2015
openvpn_autoconfig and install for Ubuntu 14.04 (digitalocean)
View AutoOpenVPN.sh
#!/bin/bash
#
# Script to set up OpenVPN for routing all traffic.
# https://github.com/tinfoil/openvpn_autoconfig
#
set -e
if [[ $EUID -ne 0 ]]; then
echo "You must be a root user" 1>&2
exit 1
@m0k1
m0k1 / vnc_manual.txt
Last active Nov 25, 2015
How to install VNC server ubuntu digitalocean
View vnc_manual.txt
just edit the vnc_user in this text
-------------------------------
apt-get install gnome-core xfce4 firefox
apt-get install vnc4server
adduser vnc_user
su - vnc_user
vncserver
cp ~/.vnc/xstartup ~/.vnc/xstartup.bak
rm -rf ~/.vnc/xstartup
View ubuntu-php-development-environment.md

#Introduction If you're a php developer on ubuntu, there comes the time where you have to install/reinstall your system. I did it already a few times and i decided to write down the steps for a typical web developer stack with php. This is for a developer machine and not for a live environment!

I hope it helps you too!

fyi @mheiniger and me started with an installer here: https://github.com/mheiniger/webdev-setup

@m0k1
m0k1 / CmdsFS.pwn
Created Jun 24, 2015
TestFunctions FilterScript
View CmdsFS.pwn
#include <a_samp>
#define SendFormatMsg(%0,%1) new strformatmsg[512]; format(strformatmsg, 512, %0, %1); SendText(playerid,strformatmsg)
#define SendFormatMsgToAll(%0,%1) new strformatmsg[512]; format(strformatmsg, 512, %0, %1); SendClientMessageToAll(-1,strformatmsg)
#define SendFormatMsgForPlayer(%0,%1,%2) new strformatmsg[512]; format(strformatmsg, 512, %1, %2); SendText(%0,strformatmsg)
#define ifCMD(%0) if(!strcmp(cmd, %0, true))
#define RetMsg(%0) new RetStrMsg[512] = %0
#define GetInt(%0) cmd = GetParameter(cmdtext, idx); if(!strlen(cmd)) return SendText(playerid, RetStrMsg); new %0 = strval(cmd)
#define GetFloat(%0) cmd = GetParameter(cmdtext, idx); if(!strlen(cmd)) return SendText(playerid, RetStrMsg); new Float:%0 = floatstr(cmd)
#define GetText(%0) cmd = GetParameter(cmdtext, idx); if(!strlen(cmd)) return SendText(playerid, RetStrMsg); new Text:%0 = Text:strval(cmd)
@m0k1
m0k1 / main.cpp
Created Jun 24, 2015
Test sa-mp functions ingame. (main.cpp)
View main.cpp
#include <stdio.h>
#include <string.h>
using namespace std;
bool strEqual(char string[], char toComp[])
{
int len = strlen(toComp);
char oldchar = string[len];
@m0k1
m0k1 / xgoto.pwn
Created May 28, 2015
xgoto by m0k1
View xgoto.pwn
#include <sscanf2> // By Y_Less, 2.8.2: http://forum.sa-mp.com/showthread.php?t=570927
#include <YSI\y_commands> // By Y_Less, f4d85a8: http://forum.sa-mp.com/showthread.php?t=570884
#include <YSI\y_master> // By Y_Less, f4d85a8: http://forum.sa-mp.com/showthread.php?t=570884
YCMD:xgoto(playerid, params[], help)
{
new string[256], Float:x,Float:y,Float:z;
if(sscanf(params, "fff", x,y,z)) return SendClientMessage(playerid, -1, ""#SMCOLOR"[SM:CMD] {FFFF00}/xgoto [x] [y] [z]");
format(string, sizeof(string), ""#SMCOLOR"[SM] {FFFF00}Portovao si se do %f %f %f", x,y,z);
SendClientMessage(playerid, COLOR_LIGHTRED2, string);
@m0k1
m0k1 / check_id_exist.php
Created May 15, 2015
Check if ID exist in database
View check_id_exist.php
<?php
$mysql_server = "localhost";
$mysql_user = "username";
$mysql_password = "password";
$mysql_dbname = "db";
$mysqlcon = new mysqli($mysql_server, $mysql_user, $mysql_password, $mysql_dbname);
if ($mysqlcon->connect_error) {
die("Connection failed: " . $mysqlcon->connect_error);
}