Skip to content

Instantly share code, notes, and snippets.

View AlbinoDrought's full-sized avatar
🇨🇦
Use AGPL

Sean AlbinoDrought

🇨🇦
Use AGPL
View GitHub Profile
@AlbinoDrought
AlbinoDrought / GarglC#
Created February 10, 2015 19:32
Example C# Gargl output of yahoo template
using System;
using System.Net;
using System.IO;
public class YahooSearch
{
public string Autocomplete (string term)
{
string url = "http://sugg.search.yahoo.com/gossip-us-fp/" + "?output=yjsonp&nresults=10&version=&command=" + term + "&queryfirst=2";
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
using System;
using System.Net;
using System.IO;
public class Sample-Site
{
public string Function1 (string topic,string variableParamValue,string subtopic)
{
string url = "http://www.samplesite.com/@topic@/@subtopic@" + "?staticParam=value1&variableParam=" + variableParamValue + "";
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
@AlbinoDrought
AlbinoDrought / css_only_separators.html
Created July 29, 2016 21:33
Separate elements only if both are not empty, using only CSS
<html>
<head>
<style type="text/css">
.s:not(:empty)+.s:not(:empty):before {
content: " / ";
}
</style>
</head>
<body>
<div>
# For all those forgetful people....
alias where='echo "You probably mean \"whereis\"!"; whereis'
@AlbinoDrought
AlbinoDrought / auto-colorize.less
Created September 26, 2016 18:58
Auto-generate contrasted color pairs with LESS
@contrast-level: 85%;
.auto-colorize(@text-color) {
color: @text-color;
// pick the color with the most contrast to our text color
// _should_ at least be readable with light colors
background-color: contrast(
@text-color,
shade(@text-color, @contrast-level),
@AlbinoDrought
AlbinoDrought / hackmud_rainbow.js
Created September 28, 2016 04:55
Turns a number (0 <= i <= 52) into a hackmud-compatible color code.
/*
Using color codes:
`0message`
`1message`
`amessage`
`Amessage`
The game matches the following regex:
`(?:([0-9])|([a-z])|([A-Z]))(.+?)`
*/
<?php
/*
with all the esoteric functions PHP has, you would think they would also have something like this:
*/
function ifset($array, $key, $ifnotset = null) {
if(isset($array[$key])) return $array[$key];
return $ifnotset;
@AlbinoDrought
AlbinoDrought / deploy.php
Last active April 17, 2017 21:12
Deploying PHP to a Cygwin Windows machine using Deployer (deployer.org)
function decygwin($path) {
return preg_replace('/\/cygdrive\/(\D)\//', '$1:/', $path);
}
// use native symlinks, because non-native cygwin symlinks are not "directories": `is_dir('cygwin-symlink') == false`
set('env_vars', 'CYGWIN="winsymlinks:nativestrict"');
// cygwin release path fix
// replaces the cygwin release path (/cygdrive/c/) with the windows release path (C:/)
// increases compatibility with things like non-cygwin PHP for composer installs
@AlbinoDrought
AlbinoDrought / make-client-key.sh
Created April 18, 2017 23:15
Vault SSH Secret Backend quick and dirty setup
#!/bin/bash
FILE="client_key"
OUTPUT_FILE="client_key-cert.pub"
echo "Generating new key..."
ssh-keygen -t rsa -f $FILE -N ''
echo "Getting client key signed by Vault..."
cat $FILE.pub | vault write ssh-client-signer/sign/clientrole public_key=- | grep "signed_key" | cut -f 2 > $OUTPUT_FILE
// ==UserScript==
// @name Automatic Tab Closer
// @namespace http://tampermonkey.net/
// @version 0.1
// @description No more tab hogging ;)
// @author AlbinoDrought
// @match *://www.w3schools.com/*
// @match *://php.net/*
// @match *://www.google.ca/*
// @grant window.close