Skip to content

Instantly share code, notes, and snippets.

View ricardosaracino's full-sized avatar

Ricardo Saracino ricardosaracino

View GitHub Profile
@ricardosaracino
ricardosaracino / chromebox.md
Created June 30, 2016 14:10
Hacking an ASUS chromebox

ASUS makes a pretty handy Chromebox, and it's handy not just because it's running ChromeOS, it's handy because of everything you can do to the box itself.

The ASUS Chromebox is easily upgradeable, and capable of running just about any linux distribution.

The model I picked up, the M004U has the following specs:

  • Celeron 2955U (1.4GHz) 64 bit Dual core processor with 2MB L3 Cache
  • 2GB DDR3 1600 RAM with 2 slots
  • 16GB SSD HDD
  • 802.11 b/g/n dual-band wireless, Bluetooth 4.0, and gigabit ethernet
@rodneyrehm
rodneyrehm / demo-list.html
Created May 28, 2012 11:08
jQuery Snippets - jQuery.sortChildren()
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>sorting lists</title>
<script src="jquery-1.7.2.min.js"></script>
<script src="jquery.sortChildren.js"></script>
<script>
@mrshridhara
mrshridhara / MessageLoggingHandler.cs
Created July 7, 2014 13:44
DelegatingHandler to log request and response of a Web API call.
using System;
using System.Net.Http;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
/// <summary>
/// </summary>
public class MessageLoggingHandler : DelegatingHandler
{
@mumumu
mumumu / ImageRotateUtil.java
Last active April 8, 2022 11:03
Automatically corrects the orientation of image by interpreting exif:Orientation value. This class depends on JMagick and apache-sanselan.
package org.mumumu.test;
import java.io.ByteArrayOutputStream;
import magick.ImageInfo;
import magick.MagickImage;
import org.apache.sanselan.Sanselan;
import org.apache.sanselan.common.IImageMetadata;
import org.apache.sanselan.formats.jpeg.JpegImageMetadata;
@webjay
webjay / gh_hook.php
Last active January 7, 2023 11:54
Php hook script that can git pull, apc_clear_cache() etc
<?php
ignore_user_abort(true);
function syscall ($cmd, $cwd) {
$descriptorspec = array(
1 => array('pipe', 'w'), // stdout is a pipe that the child will write to
2 => array('pipe', 'w') // stderr
@xiaol825
xiaol825 / install.txt
Last active October 17, 2023 02:37 — forked from ziadoz/install.sh
How to install Chrome, ChromeDriver and Selenium on CentOS. Plus a sample scraping script.
#!/usr/bin/env bash
# https://developers.supportbee.com/blog/setting-up-cucumber-to-run-with-Chrome-on-Linux/
# https://gist.github.com/curtismcmullan/7be1a8c1c841a9d8db2c
# http://stackoverflow.com/questions/10792403/how-do-i-get-chrome-working-with-selenium-using-php-webdriver
# http://stackoverflow.com/questions/26133486/how-to-specify-binary-path-for-remote-chromedriver-in-codeception
# http://stackoverflow.com/questions/40262682/how-to-run-selenium-3-x-with-chrome-driver-through-terminal
# http://askubuntu.com/questions/760085/how-do-you-install-google-chrome-on-ubuntu-16-04
# Versions
CHROME_DRIVER_VERSION=`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE`
@lesstif
lesstif / HMacTest.java
Last active February 27, 2024 07:10
HMAC SHA256 example java code
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
public class HMacTest {
public static final String ALGORITHM = "HmacSHA256";
public static String calculateHMac(String key, String data) throws Exception {
Mac sha256_HMAC = Mac.getInstance(ALGORITHM);
@goyalmohit
goyalmohit / configure-ssl-for-jenkins-on-centos.sh
Last active February 29, 2024 22:36
Configure SSL for Jenkins on CentOS
#This gist is related to blog post https://mohitgoyal.co/2017/02/08/securing-your-jenkins-environment-and-configure-for-auditing/
# Generate certificate csr
openssl req -new > new.ssl.csr
# Create a key file for generating certificate
openssl rsa -in privkey.pem -out new.cert.key
# Create a csr file using the key file for 635 days
openssl x509 -in new.ssl.csr -out new.cert.cert -req -signkey new.cert.key -days 365
@tawfekov
tawfekov / generator.php
Last active March 2, 2024 16:06
Doctrine2 Generate Entities form Existing Database
<?php
include '../vendor/autoload.php';
$classLoader = new \Doctrine\Common\ClassLoader('Entities', __DIR__);
$classLoader->register();
$classLoader = new \Doctrine\Common\ClassLoader('Proxies', __DIR__);
$classLoader->register();
// config
$config = new \Doctrine\ORM\Configuration();
@ereli
ereli / gist:a0faf53e417403df8863
Created April 9, 2015 10:15
prevent screensaver and workstation lockout - vbs script that presses the numlock key twice every 10 seconds
# ref: http://superuser.com/a/836346
Dim objResult
Set objShell = WScript.CreateObject("WScript.Shell")
i = 0
Do While i = 0
objResult = objShell.sendkeys("{NUMLOCK}{NUMLOCK}")
Wscript.Sleep (10000)