Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am vhogemann on github.
  • I am vhogemann (https://keybase.io/vhogemann) on keybase.
  • I have a public key ASA_DuDI3YD6ZS9-IW0PaaZvm-8G0teGzybzSob-JYRsbwo

To claim this, I am signing this object:

@vhogemann
vhogemann / RandomPort.fs
Last active November 15, 2023 12:03
Quick and dirty example of how to get a random open TCP/UDP port using F#
namespace Test
module RandomPort =
open System
open System.Net.NetworkInformation
let isFree port =
let props =
IPGlobalProperties.GetIPGlobalProperties()
let tcpListeners =
props.GetActiveTcpListeners()
//@ts-check
const fs = require("fs");
const axios = require("axios").default;
let bearerToken = process.env.TWITTER_BEARER_TOKEN;
const headers = { 'Authorization': `Bearer ${bearerToken}` };
const client = axios.create({baseURL : 'https://api.twitter.com/1.1/tweets/search/', headers : headers})
@vhogemann
vhogemann / keys.pipe.ts
Created May 26, 2017 11:20
Iterate over an Object keys using *ngFor
/**
* Use like *ngFor="let key of ( object | keys )"
*/
@Pipe({ name: 'keys', pure: false })
export class KeysPipe implements PipeTransform {
transform(value: any, args: any[] = null): any {
if(!value) return [];
return Object.keys(value);
}
}
@vhogemann
vhogemann / debounce.decorator.ts
Created May 26, 2017 11:14
Simple method Debouncer for typescript class methods
export function Debounce(wait: number) {
return function (target: any, propertyKey: string, descriptor: PropertyDescriptor) {
let timeout;
const original:Function = descriptor.value;
const debounced = function() {
const context = this;
const args = arguments;
const later = function() {
timeout = null;
original.apply(context, args);
#! /bin/bash
# String retornada pelo reg.exe em caso de update com sucesso
REG_UP_OK="The operation completed successfully"
# Checa se existe lista de hosts não atualizados
if [ -e mortos.txt ]; then
# Se existe, renomeia para tmp.txt e o utiliza...
# criando uma nova lista para as maquinas que não atualizarem
mv mortos.txt tmp.txt
HOST_LIST="tmp.txt"
else