Skip to content

Instantly share code, notes, and snippets.

View trinvh's full-sized avatar

Tri Nguyen trinvh

View GitHub Profile
When download a github content, it thows following error:
"ERROR: certificate ....To connect to raw.github.com insecurely, use `--no-check-certificate'"
Problem:
+ Unset valid time/timezone.
+ CA Certificate invalid.
Resolve:
@trinvh
trinvh / MomentDateTimeDirective.js
Created February 24, 2017 14:05
Angular 1.x moment input directive with validators and formatters
function momentDateTime() {
var format = "YYYY-MM-DD HH:mm"
//date.isValid() is not enough for strict validation, see moment.js doc
var pattern = /^\s*\d{4}-\d{2}-\d{2}\s+\d{2}:\d{2}(:\d{2})?\s*$/
return {
restrict: 'A',
require: 'ngModel',
link: function (scope, element, attr, ngModel) {
ngModel.$parsers.push(function (text) {
var date = moment(text, format);
@trinvh
trinvh / Emulator Guide.md
Created March 28, 2017 16:55 — forked from patrickkettner/Emulator Guide.md
Quick guide on settings up emulators for various mobile platforms.

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. Will not work if proxied (source).

update: A minor variant of the viru

public class CertificateViewModel
{
public int Id { get; set; }
public AccountViewModel Account { get; set; }
public CertificateType Type { get; set; }
public CertificateRegionType Region { get; set; }
public class CertificateApiEditModel : IValidatableObject
{
[Required]
public CertificateType? Type { get; set; }
[Required]
public CertificateRegionType? Region { get; set; }
//[MustBeTrue]
public bool SignedOff { get; set; }
@trinvh
trinvh / gist:af1adef88213fe76917d941a7430f97c
Created February 27, 2018 10:52 — forked from rkuzsma/gist:b9a0e342c56479f5e58d654b1341f01e
Example Kubernetes yaml to pull a private DockerHub image
Step by step how to pull a private DockerHub hosted image in a Kubernetes YML.
export DOCKER_REGISTRY_SERVER=https://index.docker.io/v1/
export DOCKER_USER=Type your dockerhub username, same as when you `docker login`
export DOCKER_EMAIL=Type your dockerhub email, same as when you `docker login`
export DOCKER_PASSWORD=Type your dockerhub pw, same as when you `docker login`
kubectl create secret docker-registry myregistrykey \
--docker-server=$DOCKER_REGISTRY_SERVER \
--docker-username=$DOCKER_USER \
@trinvh
trinvh / router.php
Last active April 2, 2018 10:22
router.php
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$DOMAIN = 'api.mixcord.co';
$site = "https://" . $DOMAIN;
$request = $_SERVER["REQUEST_URI"];
$url = $site . $request;
@trinvh
trinvh / www.conf
Created April 26, 2018 01:58
Default php7.0-fpm config
; Start a new pool named 'www'.
; the variable $pool can be used in any directive and will be replaced by the
; pool name ('www' here)
[www]
; Per pool prefix
; It only applies on the following directives:
; - 'access.log'
; - 'slowlog'
; - 'listen' (unixsocket)