Skip to content

Instantly share code, notes, and snippets.

View Daniel15's full-sized avatar
💭
Busy

Daniel Lo Nigro Daniel15

💭
Busy
View GitHub Profile
@Daniel15
Daniel15 / 1_Twitter autoresponder bot.md
Last active December 6, 2021 20:37
Twitter autoresponder bot

Twitter autoresponder bot

By Daniel15 (dan.cx) This is a very simple Twitter autoresponder bot. It requires PECL OAuth extension to be installed (run "pecl install oauth", or if on Windows, grab php-oauth.dll. If using cPanel you can install it via WHM). The authentication is designed for command-line usage, it won't work too well via a web browser. You'll have to sign up for an application on Twitter's site to get the consumer key and secret.

Could be modified to be more advanced (match regular expressions to answer questions, etc.)

Questions? See my blog post - http://dan.cx/blog/2011/06/twitter-autoreply-bot-dbznappa

Modified 2013-06-13 - Twitter API 1.0 discontinued, modified to use Twitter API 1.1

@Daniel15
Daniel15 / 1_README.md
Created October 3, 2011 03:20
ASP.NET Server Info page

Simple ASP.NET server info page. Shows uptime, hard drive space, and RAM.

Add this to Web.config system.web -> configuration -> assemblies:

@Daniel15
Daniel15 / GtkDimScreen.cs
Created November 21, 2011 04:31
Semi-transparent window in GTK# (Mono, C#)
using System;
using System.Reflection;
using System.Runtime.InteropServices;
using Cairo;
using Gtk;
public class GtkDimScreen
{
private DrawingArea drawingArea;
@Daniel15
Daniel15 / gist:1709107
Created January 31, 2012 05:58
Get content of currently executing page (ASP / VBScript)
Dim sPath
Dim oFS
Dim oTextStream
Dim sFile
sPath = Server.MapPath(Request.ServerVariables("SCRIPT_NAME"))
Set oFS = CreateObject("Scripting.FileSystemObject")
Set oTextStream = oFS.OpenTextFile(sPath, 1)
sFile = oTextStream.ReadAll()
Set oFS = Nothing
@Daniel15
Daniel15 / dabblet.css
Created March 6, 2012 06:02
Telstra buttons example
.telstra
{
border: 0;
padding: 0 0 0 30px;
margin: 0;
background: white url(http://i.imgur.com/N14wq.png) no-repeat;
height: 25px;
line-height: 25px;
cursor: pointer;
color: #003366;
@Daniel15
Daniel15 / gist:2271700
Created April 1, 2012 05:32
PHP crash
root@lisa:/# /etc/init.d/php5-fpm restart
Restarting PHP5 FastCGI Process Manager: php5-fpm*** glibc detected *** /usr/sbin/php5-fpm: free(): invalid pointer: 0xb6d860f0 ***
======= Backtrace: =========
/lib/i386-linux-gnu/libc.so.6(+0x6e1da)[0xb6f621da]
/lib/i386-linux-gnu/libc.so.6(+0x6fa38)[0xb6f63a38]
/lib/i386-linux-gnu/libc.so.6(cfree+0x6d)[0xb6f66b3d]
/usr/sbin/php5-fpm(destroy_zend_class+0x228)[0x83192a8]
======= Memory map: ========
08048000-08710000 r-xp 00000000 08:01 11403530 /usr/sbin/php5-fpm
08710000-08771000 r-xp 006c7000 08:01 11403530 /usr/sbin/php5-fpm
@Daniel15
Daniel15 / gist:2549243
Created April 29, 2012 10:32
LESS mixin for RGBA colours in IE
// Use with colour name: .rgba(black, 0.5) or hex value: .rgba(#FF2400, 0.5)
.rgba(@colour, @alpha)
{
@alphaColour: hsla(hue(@colour), saturation(@colour), lightness(@colour), @alpha);
@ieAlphaColour: argb(@alphaColour);
background-color: @colour; // Fallback for older browsers
background-color: @alphaColour;
// IE hacks
@Daniel15
Daniel15 / gist:2826819
Created May 29, 2012 10:54
Internet Explorer's console.log is not actually a function.
>> document.getElementById
function getElementById() { [native code] }
>> document.getElementById instanceof Function
true
>> document.getElementById.apply
function apply() { [native code] }
>> typeof(document.getElementById)
"function"
>> console.log
function log() { [native code] }
@Daniel15
Daniel15 / gist:3074365
Created July 9, 2012 05:26
Validating JSONP callback function name in C#
/// <summary>
/// Validation of JSONP callback function names
/// </summary>
/// <remarks>
/// Based off the PHP code at https://gist.github.com/1217080, which is originally based off
/// a blog post at http://tav.espians.com/sanitising-jsonp-callback-identifiers-for-security.html
/// </remarks>
public class JsonValidator
{
/// <summary>