Skip to content

Instantly share code, notes, and snippets.

@vietlq
vietlq / po2js.php
Created November 4, 2016 16:47 — forked from voduytuan/po2js.php
<?php
/**
* Download from: https://code.google.com/archive/p/php-po-parser/source/default/source
*/
include('./libs/POParser.php');
/**
* Example config.json
{
@vietlq
vietlq / letsencrypt.md
Created November 9, 2016 15:10 — forked from xrstf/letsencrypt.md
Let's Encrypt on Ubuntu 14.04, nginx with webroot auth

Let's Encrypt on Ubuntu 14.04, nginx with webroot auth

This document details how I setup LE on my server. Firstly, install the client as described on http://letsencrypt.readthedocs.org/en/latest/using.html and make sure you can execute it. I put it in /root/letsencrypt.

As it is not possible to change the ports used for the standalone authenticator and I already have a nginx running on port 80/443, I opted to use the webroot method for each of my domains (note that LE does not issue wildcard certificates by design, so you probably want to get a cert for www.example.com and example.com).

Configuration

For this, I placed config files into etc/letsencrypt/configs, named after <domain>.conf. The files are simple:

@vietlq
vietlq / Virtual Box Host Only Static IP.md
Created April 15, 2017 20:50 — forked from pjdietz/Virtual Box Host Only Static IP.md
VirtualBox Host-Only Adapter with Static IP

VirtualBox Host-Only Static IP

My typical setup for a development box in VirtualBox uses two NICs. The first uses NAT to allow the box to communicate with the outside world through my host computer’s network connection. (NAT is the default, so shouldn't require any setup.) The second is a "host-only" connection that allows my host and guest to interact.

To create a host-only connection in VirtualBox, start by opening the preferences in VirtualBox. Go to the "Network" tab, and addd a Host-only Network. Modify the host-only network, and disable DHCP. Make a note of the IP address. (Feel free to set the IP address as well, if you like.)

Next, assign this host-only adapter to the virtual machine. Select the VM and press "Settings". Go to the "Network" tab, and select "Adpater 2". Enable the adapter, set it to a "Host-only Adapter", and select the adpater you created above.

Temporary

@vietlq
vietlq / mmap-fork.c
Created April 22, 2017 21:17 — forked from kashyapp/mmap-fork.c
sample code to test out fork and mmap of shared memory
#include <time.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <stdlib.h>
#include <sys/stat.h> /* For mode constants */
#include <fcntl.h> /* For O_* constants */
@vietlq
vietlq / rm.js
Created May 2, 2017 21:53
recursive directory delete with promises (using rsvp) in node.js
var rsvp = require("rsvp")
var Promise = rsvp.Promise;
function cleardir(path) {
return new Promise(function(resolve, reject) {
fs.readdir(path, function(err, dir) {
if (err) {
reject(err);
return;
}

WannaCry|WannaDecrypt0r NSA-Cyberweapon-Powered Ransomware Worm

  • Virus Name: WannaCrypt, WannaCry, WanaCrypt0r, WCrypt, WCRY
  • Vector: All Windows versions before Windows 10 are vulnerable if not patched for MS-17-010. It uses EternalBlue MS17-010 to propagate.
  • Ransom: between $300 to $600. There is code to 'rm' (delete) files in the virus. Seems to reset if the virus crashes.
  • Backdooring: The worm loops through every RDP session on a system to run the ransomware as that user. It also installs the DOUBLEPULSAR backdoor. It corrupts shadow volumes to make recovery harder. (source: malwarebytes)
  • Kill switch: If the website www.iuqerfsodp9ifjaposdfjhgosurijfaewrwergwea.com is up the virus exits instead of infecting the host. (source: malwarebytes). This domain has been sinkholed, stopping the spread of the worm.

SECURITY BULLETIN AND UPDATES HERE: https://technet.microsoft.com/en-us/library/security/ms17-010.aspx

@vietlq
vietlq / .bash_profile
Last active July 3, 2017 05:50 — forked from molivier/gist:271bba5d67de1583a8e3
Set $GOPATH on Mac OSX : bash_profile
# Edit ~/.bash_profile
export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$PATH
# Reload profile : source ~/.bash_profile
@vietlq
vietlq / arduinoclock.cpp
Created August 23, 2017 18:51 — forked from Bravo555/arduinoclock.cpp
Arduino clock project
#include <Wire.h>
#include <TimeLib.h>
#include <DS1307RTC.h>
#include <LiquidCrystal_I2C.h>
int budzikGodzina = 7, budzikMinuta = 0;
LiquidCrystal_I2C lcd(0x27, 16, 2);
tmElements_t tm;
@vietlq
vietlq / arduinoclock.cpp
Created August 23, 2017 18:51 — forked from Bravo555/arduinoclock.cpp
Arduino clock project
#include <Wire.h>
#include <TimeLib.h>
#include <DS1307RTC.h>
#include <LiquidCrystal_I2C.h>
int budzikGodzina = 7, budzikMinuta = 0;
LiquidCrystal_I2C lcd(0x27, 16, 2);
tmElements_t tm;
@vietlq
vietlq / Rinkeby.md
Created October 5, 2017 20:33 — forked from learner-long-life/Rinkeby.md
How to get on Rinkeby Testnet in less than 10 minutes

How to get on Rinkeby Testnet in less than 10 minutes

Following instructions from the excellent https://www.rinkeby.io/

Synchronizing a Full Node

A full node lets you access all state. There is a light node (state-on-demand) and wallet-only (no state) instructions as well,